[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Broken entrypoints package: actually a pybuild issue?



Hi,

I found the source of the breakage for the entrypoints package: its
tests/samples/ directory contains a few files describing mock Python
packages, and the tests consist in running functions on those and check
the answers match what is expected.

Alas, something (and I suspect pybuild) removes the *.egg-info
directories there, so of course results don't match.

I see two ways out:

(1) configure something so tests/samples/ doesn't get touched ;

(2) patch the tests to adapt them to the modified directories.


Solution (2) is pretty fast, pretty easy and extremely dirty: it will
need an update for each upstream change and that basically means the
tests don't actually test anything.

Solution (1) is much more reliable, but I neither know if it's possible
nor how - can someone lend a hand?

Thanks!

J.Puydt

PS: the patch would be that ugly:

Description: fix bug #1052826 (broken tests)
Author: Julien Puydt
Forwarded: not needed
--- entrypoints.orig/tests/test_entrypoints.py
+++ entrypoints/tests/test_entrypoints.py
@@ -19,31 +19,31 @@
 
 def test_iter_files_distros():
     result = entrypoints.iter_files_distros(path=sample_path)
-    # the sample_path has 4 unique items so iter_files_distros returns
4 tuples
-    assert len(list(result)) == 4
+    # the sample_path has 3 unique items so iter_files_distros returns
3 tuples
+    assert len(list(result)) == 3
 
     # testing a development, egg aka installed with pip install -e .
     # these don't have version info in the .egg-info directory name
     # (eg dev-0.0.1.egg-info)
     path_with_dev = [osp.join(samples_dir, 'packages4')]
     result = entrypoints.iter_files_distros(path=path_with_dev)
-    assert len(list(result)) == 1
+    assert len(list(result)) == 0
 
     # duplicate dev versions should still return one result
     path_with_dev_duplicates = path_with_dev * 2
     result =
entrypoints.iter_files_distros(path=path_with_dev_duplicates)
-    assert len(list(result)) == 1
+    assert len(list(result)) == 0
 
 def test_get_group_all():
     group = entrypoints.get_group_all('entrypoints.test1',
sample_path)
     print(group)
-    assert len(group) == 5
-    assert {ep.name for ep in group} == {'abc', 'rew', 'opo', 'njn'}
+    assert len(group) == 3
+    assert {ep.name for ep in group} == {'abc', 'rew', 'njn'}
 
 def test_get_group_named():
     group = entrypoints.get_group_named('entrypoints.test1',
sample_path)
     print(group)
-    assert len(group) == 4
+    assert len(group) == 3
     assert group['abc'].module_name == 'foo'
     assert group['abc'].object_name == 'abc'
 


Reply to: