diff options
Diffstat (limited to 'pkg_resources')
| -rw-r--r-- | pkg_resources/__init__.py | 9 | ||||
| -rw-r--r-- | pkg_resources/tests/test_pkg_resources.py | 5 | ||||
| -rw-r--r-- | pkg_resources/tests/test_resources.py | 7 |
3 files changed, 5 insertions, 16 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 33b3f56c..12226d4b 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ Package resource API -------------------- @@ -74,7 +73,6 @@ __import__('pkg_resources.extern.packaging.specifiers') __import__('pkg_resources.extern.packaging.requirements') __import__('pkg_resources.extern.packaging.markers') - if (3, 0) < sys.version_info < (3, 3): msg = ( "Support for Python 3.0-3.2 has been dropped. Future versions " @@ -96,7 +94,6 @@ class PEP440Warning(RuntimeWarning): class _SetuptoolsVersionMixin(object): - def __hash__(self): return super(_SetuptoolsVersionMixin, self).__hash__() @@ -578,7 +575,6 @@ def get_entry_info(dist, group, name): class IMetadataProvider: - def has_metadata(name): """Does the package's distribution contain the named metadata?""" @@ -2738,7 +2734,6 @@ class Distribution(object): class EggInfoDistribution(Distribution): - def _reload_version(self): """ Packages installed by distutils (e.g. numpy or scipy), @@ -2825,7 +2820,6 @@ def issue_warning(*args, **kw): class RequirementParseError(ValueError): - def __str__(self): return ' '.join(self.args) @@ -2850,7 +2844,6 @@ def parse_requirements(strs): class Requirement(packaging.requirements.Requirement): - def __init__(self, requirement_string): """DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!""" try: @@ -2906,8 +2899,10 @@ class Requirement(packaging.requirements.Requirement): def _get_mro(cls): """Get an mro for a type or classic class""" if not isinstance(cls, type): + class cls(cls, object): pass + return cls.__mro__[1:] return cls.__mro__ diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 361fe657..49bf7a04 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -18,7 +18,6 @@ import pytest import pkg_resources - try: unicode except NameError: @@ -37,7 +36,6 @@ def timestamp(dt): class EggRemover(unicode): - def __call__(self): if self in sys.path: sys.path.remove(self) @@ -100,7 +98,6 @@ class TestZipProvider(object): class TestResourceManager(object): - def test_get_cache_path(self): mgr = pkg_resources.ResourceManager() path = mgr.get_cache_path('foo') @@ -130,13 +127,13 @@ class TestIndependence: class TestDeepVersionLookupDistutils(object): - @pytest.fixture def env(self, tmpdir): """ Create a package environment, similar to a virtualenv, in which packages are installed. """ + class Environment(str): pass diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py index 3b13884b..00ca7426 100644 --- a/pkg_resources/tests/test_resources.py +++ b/pkg_resources/tests/test_resources.py @@ -36,7 +36,6 @@ dist_from_fn = pkg_resources.Distribution.from_filename class TestDistro: - def testCollection(self): # empty path should produce no distributions ad = pkg_resources.Environment([], platform=None, python=None) @@ -313,7 +312,6 @@ class TestDistro: class TestWorkingSet: - def test_find_conflicting(self): ws = WorkingSet([]) Foo = Distribution.from_filename("/foo_dir/Foo-1.2.egg") @@ -356,7 +354,6 @@ class TestWorkingSet: class TestEntryPoints: - def assertfields(self, ep): assert ep.name == "foo" assert ep.module_name == "pkg_resources.tests.test_resources" @@ -457,7 +454,6 @@ class TestEntryPoints: class TestRequirements: - def testBasics(self): r = Requirement.parse("Twisted>=1.2") assert str(r) == "Twisted>=1.2" @@ -538,7 +534,6 @@ class TestRequirements: class TestParsing: - def testEmptyParse(self): assert list(parse_requirements('')) == [] @@ -701,6 +696,7 @@ class TestParsing: value of parse_version. The new parse_version returns a Version class which needs to support this behavior, at least for now. """ + def buildout(parsed_version): _final_parts = '*final-', '*final' @@ -709,6 +705,7 @@ class TestParsing: if (part[:1] == '*') and (part not in _final_parts): return False return True + return _final_version(parsed_version) assert buildout(parse_version("1.0")) |
