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

Use pytest as a test runner #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Use pytest as a test runner #31

wants to merge 3 commits into from

Conversation

mgedmin
Copy link
Owner

@mgedmin mgedmin commented Nov 27, 2024

It is very unfortunate that I need to use pytest -s to run the tests. I was unable to find a way of avoiding that.

I haven't found a way of using a custom doctest checker with pytest either. The test suite might be completely broken on Windows. This is why I'm pushing to a branch.

It is very unfortunate that I need to use pytest -s to run the tests.  I
was unable to find a way of avoiding that.

I haven't found a way of using a custom doctest checker with pytest
either.  The test suite might be completely broken on Windows.  This is
why I'm pushing to a branch.
Wow this was hard.  So:

1. Our code doesn't really handle pathlib.Path objects on sys.path, so
   the scanning-inside-.zip-file was not being handled.  I'm not sure
   why there were no failures, other than the coverage numbers.

2. Let's avoid importing Python 2 only modules like cPickle or cStringIO
   or email.Message; again I'm not sure why there were no errors about
   these names not existing.

3. Finally, the 'does a file exist on sys.path' was being exercised
   while looking for email/message.py before, but now something in
   pytest or coverage imports email.message, so it's found in sys.path,
   which short-circuits my isModule() check.  I picked curses.panel
   instead, as something unlikely to be imported by the test runner.
I don't have high hopes for this approach, but why not try it?
@mgedmin mgedmin marked this pull request as ready for review November 27, 2024 19:33
@mgedmin
Copy link
Owner Author

mgedmin commented Nov 29, 2024

Blocked on pytest-dev/pytest#13003, unless I can come up with some alternative solution (like rewriting the entire test suite from scratch).

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

Successfully merging this pull request may close these issues.

1 participant