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

Revert #656 on master branch or improve skipping of tests #662

Closed
corranwebster opened this issue Aug 10, 2020 · 3 comments · Fixed by #665
Closed

Revert #656 on master branch or improve skipping of tests #662

corranwebster opened this issue Aug 10, 2020 · 3 comments · Fixed by #665
Labels
component: test suite Issues related to testing, test support, test interactions... type: refactoring Issues related to refactoring

Comments

@corranwebster
Copy link
Contributor

Having a look at the awkwardness of avoiding problems by skipping tests with Traits 6.0, I would strongly recommend either we:

I'm generally in favour of the first as long as we are good about maintenance releases, as I think it just adds complexity and makes implicit promises that I'm not sure are worth the extra effort.

@corranwebster corranwebster added component: test suite Issues related to testing, test support, test interactions... type: refactoring Issues related to refactoring labels Aug 10, 2020
@kitchoi
Copy link
Contributor

kitchoi commented Aug 10, 2020

It does not seem very difficult to me to be wrapping imports and test case with conditions actually. It has the benefit of skipping the tests even if you are running the test module individually without using unittest discover.

But I think the second option of skipping the tests using load_tests is fine too. I would avoid using environment variable like the EXCLUDE_TESTS because people running the test suite not via etstool.py won't have the environment variable set.

I'd still advocate we keep compatibility with Traits 6.0.

@corranwebster
Copy link
Contributor Author

Actually, having just had a look at this in some detail, I would strongly recommend using the EXCLUDE_TESTS environment variable to do this:

  • it is an existing mechanism
  • it is designed to solve the same problem (avoiding importing things that you don't want to)
  • if you run unittest discover across the entire codebase outside of etstool without the environment variable set, then we already get test failures because of the Qt/Wx import issue; this will make no difference
  • if you run unittest or unittest discover on specific sub-packages, it will either work or not in a completely predictable way (eg. python -m unittest discover pyface.tests works just fine without any environment variables set).

@kitchoi
Copy link
Contributor

kitchoi commented Aug 10, 2020

if you run unittest discover across the entire codebase outside of etstool without the environment variable set, then we already get test failures because of the Qt/Wx import issue; this will make no difference

Indeed that is the awkwardness I run into when I try to release and test the release like this:

$ python3.8 -m venv test
$ source test/bin/activate
$ pip install traits pyface[pyside2] traitsui
$ python -munittest discover pyface

I always get a test error due to failure to import wx (likewise for qt if the environment is using wx), and I have to excuse that knowing it is because of the toolkit. Likewise, if we use an environment variable with load_tests for handling traits 6.0, then one will get test errors if they install pyface from pypi along with traits 6.0 (with whatever favourite deployment manager they have). That's not very nice for the majority of users who don't use etstool.py. You want all the tests to pass if they are not skipped.

IOW I actually disagree with the existing mechanism, but for toolkit import, the error is more likely to be taken as "expected". For importing traits, it won't be as obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: test suite Issues related to testing, test support, test interactions... type: refactoring Issues related to refactoring
Projects
None yet
2 participants