File: 03-fix-pkg-resources.patch

package info (click to toggle)
pycountry 22.3.5%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 340 kB
  • sloc: python: 440; makefile: 11; sh: 7
file content (30 lines) | stat: -rw-r--r-- 1,161 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: Skip use of pkg-resources
 pkg-resources only works once the package has been installed and breaks
 in-place testing. Stub out the offending tests and fix the handling
 of the error from pkg-resources.
Origin: in part from https://github.com/flyingcircusio/pycountry/pull/47
--- a/src/pycountry/__init__.py
+++ b/src/pycountry/__init__.py
@@ -11,7 +11,7 @@
 
     resource_filename = pkg_resources.resource_filename
     __version__ = pkg_resources.get_distribution("pycountry").version
-except ImportError:
+except (ImportError, pkg_resources.DistributionNotFound):
     __version__ = "n/a"
 
     def resource_filename(package_or_requirement, resource_name):
--- a/src/pycountry/tests/test_general.py
+++ b/src/pycountry/tests/test_general.py
@@ -242,7 +242,7 @@
     assert s.get(country_code="FOOBAR") is None
 
 
-def test_has_version_attribute():
-    assert pycountry.__version__ != "n/a"
-    assert len(pycountry.__version__) >= 5
-    assert "." in pycountry.__version__
+#def test_has_version_attribute():
+    #assert pycountry.__version__ != "n/a"
+    #assert len(pycountry.__version__) >= 5
+    #assert "." in pycountry.__version__