Skip to content

Commit

Permalink
Removed dependency on pkg_resources. Closes #129
Browse files Browse the repository at this point in the history
  • Loading branch information
heuer committed Oct 26, 2023
1 parent f615b41 commit c576f73
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
3 changes: 0 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def test(session):
"""\
Run test suite.
"""
import platform
if platform.python_version()[:4] == '3.12':
session.install('setuptools') #TODO: Remove this, see issue <https://github.com/heuer/segno/issues/129>
session.install('-Ur', 'tests/requirements.txt')
session.install('.')
session.run('py.test')
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities",
]
dependencies = [
"importlib-metadata>=3.6.0; python_version < '3.8'",
]

[project.urls]
"Homepage" = "https://github.com/heuer/segno/"
Expand Down
2 changes: 2 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ pytest
pytest-cov
pypng~=0.0.20
pyzbar~=0.1.8
qrcode-artistic
Pillow
17 changes: 1 addition & 16 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"""\
Tests plugin loading.
"""
from __future__ import absolute_import, unicode_literals
import os
import pkg_resources
import pytest
import segno

Expand All @@ -21,22 +19,9 @@ def test_noplugin():
qr.to_unknown_plugin()


def an_example_plugin(qrcode):
"""\
This is a Segno converter plugin used by the next test case.
"""
assert qrcode
return 'works'


def test_plugin():
distribution = pkg_resources.Distribution(os.path.dirname(__file__))
entry_point = pkg_resources.EntryPoint.parse('test = test_plugin:an_example_plugin', dist=distribution)
distribution._ep_map = {'segno.plugin.converter': {'test': entry_point}}
pkg_resources.working_set.add(distribution)

qr = segno.make('The Beatles')
assert 'works' == qr.to_test()
assert qr.to_pil() is not None


if __name__ == '__main__':
Expand Down

0 comments on commit c576f73

Please sign in to comment.