Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heads up: Test testrunner-edge-cases.rst fails with Python 3.14.0a4 #189

Open
befeleme opened this issue Jan 29, 2025 · 1 comment
Open

Comments

@befeleme
Copy link

(future) PROBLEM REPORT

What I did:

I tried to build zope.testrunner with Python 3.14.0a4 in Fedora Linux 43.
The test output is different than what's expected.

What I expect to happen:

Test pass

What actually happened:

+ /usr/bin/python3 -m tox --current-env -q --recreate -e py314
Running tests at level 1
Running zope.testrunner.layer.UnitTests tests:
  Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
  Running:
.............

Failure in test /builddir/build/BUILD/python-zope-testrunner-6.6-build/BUILDROOT/usr/lib/python3.14/site-packages/zope/testrunner/tests/testrunner-edge-cases.rst
Failed doctest test for testrunner-edge-cases.rst
  File "/builddir/build/BUILD/python-zope-testrunner-6.6-build/BUILDROOT/usr/lib/python3.14/site-packages/zope/testrunner/tests/testrunner-edge-cases.rst", line 0

----------------------------------------------------------------------
File "/builddir/build/BUILD/python-zope-testrunner-6.6-build/BUILDROOT/usr/lib/python3.14/site-packages/zope/testrunner/tests/testrunner-edge-cases.rst", line 91, in testrunner-edge-cases.rst
Failed example:
    try: testrunner.run_internal(defaults)
    finally: sys.stdin = real_stdin
    # doctest: +ELLIPSIS
Differences (ndiff with -expected +actual):
    - Running zope.testrunner.layer.UnitTests tests:...
    ?                                               ---
    + Running zope.testrunner.layer.UnitTests tests:
    +   Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
    - > testrunner-ex/sample3/sampletests_d.py(NNN)f()
    - -> ...
      (Pdb) p x
    - 1
      (Pdb) c
        Ran 1 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
    - ...
    + Tearing down left over layers:
    +   Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
      False

What version of Python and Zope/Addons I am using:

Fedora Linux 43, Python 3.14.0a4, zope.testrunner 6.6

@icemac icemac self-assigned this Jan 31, 2025
@icemac
Copy link
Member

icemac commented Jan 31, 2025

This error is a bit strange.

The following change fixes it for all supported Python versions:

--- a/src/zope/testrunner/tests/testrunner-edge-cases.rst
+++ b/src/zope/testrunner/tests/testrunner-edge-cases.rst
@@ -92,7 +92,7 @@ Using pdb.set_trace in a function called by an ordinary test:
     ... finally: sys.stdin = real_stdin
     ... # doctest: +ELLIPSIS
     Running zope.testrunner.layer.UnitTests tests:...
-    > testrunner-ex/sample3/sampletests_d.py(47)f()
+    > ...testrunner-ex/sample3/sampletests_d.py(47)f()
     -> ...
     (Pdb) p x
     1

But only when the test is run in isolation like this:

$ tox -epy314 -- -t testrunner-edge-cases.rst

If it is run together with all the other tests it fails differently (I removed the assertion in the test file to make the diff easier to read.)

$ tox -epy314
...
File "/.../src/zope/testrunner/tests/testrunner-edge-cases.rst", line 91, in testrunner-edge-cases.rst
Failed example:
    try: testrunner.run_internal(defaults)
    finally: sys.stdin = real_stdin
    # doctest: +ELLIPSIS
Differences (ndiff with -expected +actual):
    + Running zope.testrunner.layer.UnitTests tests:
    +   Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
    + (Pdb) p x
    + (Pdb) c
    +   Ran 1 tests with 0 failures, 0 errors and 0 skipped in 0.000 seconds.
    + Tearing down left over layers:
    +   Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
    + False

So all the output of pdb is missing.

This seems to be caused by testrunner-debugging.rst, if it runs before testrunner-edge-cases.rst the error shows up.

Running them in reverse order using:
$ tox -epy314 -- -t testrunner-edge-cases.rst -t testrunner-debugging.rst -cvv --shuffle --shuffle-seed=1

breaks testrunner-debugging.rst the same way: no pdb output rendered.

I am running out of time and steam here. So if someone wants to take over?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants