zopefoundation / persistent

automatic persistence for Python objects
https://pypi.org/project/persistent/
Other
46 stars 28 forks source link

test_docs.py in wheel fails #183

Open mtelka opened 1 year ago

mtelka commented 1 year ago

The test_docs.py included in wheel fails with the following assertion:

AssertionError: could not find my setup.py

Maybe the test should pass (or skip) instead of failure if there is no setup.py available.

mtelka commented 1 year ago

This is the quick and dirty workaround:

--- persistent-5.0/src/persistent/tests/test_docs.py.orig
+++ persistent-5.0/src/persistent/tests/test_docs.py
@@ -36,7 +36,7 @@
         prev, here = here, os.path.dirname(here)
         if here == prev:
             # Let's avoid infinite loops at root
-            raise AssertionError('could not find my setup.py')
+            return unittest.TestSuite()

     docs = os.path.join(here, 'docs', 'api')
d-maurer commented 1 year ago

Marcel Telka wrote at 2023-8-10 06:38 -0700:

This is the quick and dirty workaround:


--- persistent-5.0/src/persistent/tests/test_docs.py.orig
+++ persistent-5.0/src/persistent/tests/test_docs.py
@@ -36,7 +36,7 @@
        prev, here = here, os.path.dirname(here)
        if here == prev:
            # Let's avoid infinite loops at root
-            raise AssertionError('could not find my setup.py')
+            return unittest.TestSuite()

I do not think this is the right solution.

Are you sure you are running the tests correctly?

When I run the tests on master with zope-testrunner --test-path ../persistent/src/ -v, I get


  Ran 771 tests with 0 failures, 0 errors and 6 skipped in 0.399 seconds.
```.
(I am in a sibling folder of `persistent`).
mtelka commented 1 year ago

Yes, when the test is run in the git repo (or in sdist) then it pass. I'm talking about wheel. There is no setup.py in the wheel so test_docs.py cannot pass there. Maybe the better solution would be just to exclude test_docs.py from wheel. Or, maybe even better, simply exclude all tests from wheel?

d-maurer commented 1 year ago

Marcel Telka wrote at 2023-8-10 08:22 -0700:

Yes, when the test is run in the git repo (or in sdist) then it pass. I'm talking about wheel. There is no setup.py in the wheel so test_docs.py cannot pass there. Maybe the better solution would be just to exclude test_docs.py from wheel. Or, maybe even better, simply exclude all tests from wheel?

You are right!

I think a good solution would be to skrip the test in this case (with the explaining message setup.py unavailable).

Would you like to sign a contributor agreement and provide a pull request?

mtelka commented 1 year ago

Would you like to sign a contributor agreement ...

Sorry, no.