-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
-k EXPRESSION
bug for disjunctions of parametrized tests
#5881
Comments
@leezu I've transferred your issue to the right bugtracker. |
@ionelmc thanks. I opened at pytest-dev/pytest-cov by accident.. |
seems there's a combination of things happening here first is that I don't believe It's then additionally crashing in the crash-reporting code since we have a traceback frame that doesn't act like a dictionary -- it's the fake frame that implements oddly enough, because |
I found a workaround: |
This package installs its 'tests' module into a non-package-specific location in the root site-packages directory. Python packages should/usually address this by excluding tests from installation using setup.py: find_packages(exclude[ "<package-glob>" ]). Unfortunately the above 'simple' change cannot be used because it doesn't allow the package to be tested on Python 3.x, as the tests package is not processed by 2to3, and the tests need to be run on the processed (by 2to3) sources. This may be the original reason upstream didn't remove them from the build, not grokking the ramifications. Accordingly, this change moves the tests into the main package namespace and runs the tests on the processed sources in the resulting build/* directory. Remove CONFLICTS_INSTALL (to py-suds) accordingly. While I'm here: Patch the tests to support pytest > 4 and hack around the inability to reference parametrized tests (test[foo]) in pytests -k expressions. [1][2] Level up ports compliance: LICENSE_FILE, USE{S} ordering, match COMMENT to setup.py:description, match pkg-descr WWW URL to setup.py:homepage QA: All tests pass on Python 2.7-3.8 [1] pytest-dev/pytest#5881 [2] pytest-dev/pytest#6177 PR: 226077 Reported by: yuri [1] Approved by: portmgr (blanket: ports compliance) MFH: 2020Q1 (blanket: ports compliance, port bugfixes) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@522860 35697150-7ecd-e111-bb59-0022644237b5
This package installs its 'tests' module into a non-package-specific location in the root site-packages directory. Python packages should/usually address this by excluding tests from installation using setup.py: find_packages(exclude[ "<package-glob>" ]). Unfortunately the above 'simple' change cannot be used because it doesn't allow the package to be tested on Python 3.x, as the tests package is not processed by 2to3, and the tests need to be run on the processed (by 2to3) sources. This may be the original reason upstream didn't remove them from the build, not grokking the ramifications. Accordingly, this change moves the tests into the main package namespace and runs the tests on the processed sources in the resulting build/* directory. Remove CONFLICTS_INSTALL (to py-suds) accordingly. While I'm here: Patch the tests to support pytest > 4 and hack around the inability to reference parametrized tests (test[foo]) in pytests -k expressions. [1][2] Level up ports compliance: LICENSE_FILE, USE{S} ordering, match COMMENT to setup.py:description, match pkg-descr WWW URL to setup.py:homepage QA: All tests pass on Python 2.7-3.8 [1] pytest-dev/pytest#5881 [2] pytest-dev/pytest#6177 PR: 226077 Reported by: yuri [1] Approved by: portmgr (blanket: ports compliance) MFH: 2020Q1 (blanket: ports compliance, port bugfixes)
net/py-suds-jurko: Fix tests installed into shared location [1] This package installs its 'tests' module into a non-package-specific location in the root site-packages directory. Python packages should/usually address this by excluding tests from installation using setup.py: find_packages(exclude[ "<package-glob>" ]). Unfortunately the above 'simple' change cannot be used because it doesn't allow the package to be tested on Python 3.x, as the tests package is not processed by 2to3, and the tests need to be run on the processed (by 2to3) sources. This may be the original reason upstream didn't remove them from the build, not grokking the ramifications. Accordingly, this change moves the tests into the main package namespace and runs the tests on the processed sources in the resulting build/* directory. Remove CONFLICTS_INSTALL (to py-suds) accordingly. While I'm here: Patch the tests to support pytest > 4 and hack around the inability to reference parametrized tests (test[foo]) in pytests -k expressions. [1][2] Level up ports compliance: LICENSE_FILE, USE{S} ordering, match COMMENT to setup.py:description, match pkg-descr WWW URL to setup.py:homepage QA: All tests pass on Python 2.7-3.8 [1] pytest-dev/pytest#5881 [2] pytest-dev/pytest#6177 PR: 226077 Reported by: yuri [1] Approved by: portmgr (blanket: ports compliance) net/py-suds-jurko: Bump PORTREVISION missed in ports r522860 PR: 226077 Approved by: ports-secteam (blanket(s): ports compliance, port bugfixes)
This package installs its 'tests' module into a non-package-specific location in the root site-packages directory. Python packages should/usually address this by excluding tests from installation using setup.py: find_packages(exclude[ "<package-glob>" ]). Unfortunately the above 'simple' change cannot be used because it doesn't allow the package to be tested on Python 3.x, as the tests package is not processed by 2to3, and the tests need to be run on the processed (by 2to3) sources. This may be the original reason upstream didn't remove them from the build, not grokking the ramifications. Accordingly, this change moves the tests into the main package namespace and runs the tests on the processed sources in the resulting build/* directory. Remove CONFLICTS_INSTALL (to py-suds) accordingly. While I'm here: Patch the tests to support pytest > 4 and hack around the inability to reference parametrized tests (test[foo]) in pytests -k expressions. [1][2] Level up ports compliance: LICENSE_FILE, USE{S} ordering, match COMMENT to setup.py:description, match pkg-descr WWW URL to setup.py:homepage QA: All tests pass on Python 2.7-3.8 [1] pytest-dev/pytest#5881 [2] pytest-dev/pytest#6177 PR: 226077 Reported by: yuri [1] Approved by: portmgr (blanket: ports compliance) MFH: 2020Q1 (blanket: ports compliance, port bugfixes) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@522860 35697150-7ecd-e111-bb59-0022644237b5
Previously, the expressions given to the `-m` and `-k` options were evaluated with `eval`. This causes a few issues: - Python keywords cannot be used. - Constants like numbers, None, True, False are not handled correctly. - Various syntax like numeric operators and `X if Y else Z` is supported unintentionally. - `eval()` is somewhat dangerous for arbitrary input. - Can fail in many ways so requires `except Exception`. The format we want to support is quite simple, so change to a custom parser. This fixes the issues above, and gives us full control of the format, so can be documented comprehensively and even be extended in the future if we wish. Fixes pytest-dev#1141. Fixes pytest-dev#3573. Fixes pytest-dev#5881. Fixes pytest-dev#6822. Fixes pytest-dev#7112.
Previously, the expressions given to the `-m` and `-k` options were evaluated with `eval`. This causes a few issues: - Python keywords cannot be used. - Constants like numbers, None, True, False are not handled correctly. - Various syntax like numeric operators and `X if Y else Z` is supported unintentionally. - `eval()` is somewhat dangerous for arbitrary input. - Can fail in many ways so requires `except Exception`. The format we want to support is quite simple, so change to a custom parser. This fixes the issues above, and gives us full control of the format, so can be documented comprehensively and even be extended in the future if we wish. Fixes pytest-dev#1141. Fixes pytest-dev#3573. Fixes pytest-dev#5881. Fixes pytest-dev#6822. Fixes pytest-dev#7112.
net/py-suds-jurko: Fix tests installed into shared location [1] This package installs its 'tests' module into a non-package-specific location in the root site-packages directory. Python packages should/usually address this by excluding tests from installation using setup.py: find_packages(exclude[ "<package-glob>" ]). Unfortunately the above 'simple' change cannot be used because it doesn't allow the package to be tested on Python 3.x, as the tests package is not processed by 2to3, and the tests need to be run on the processed (by 2to3) sources. This may be the original reason upstream didn't remove them from the build, not grokking the ramifications. Accordingly, this change moves the tests into the main package namespace and runs the tests on the processed sources in the resulting build/* directory. Remove CONFLICTS_INSTALL (to py-suds) accordingly. While I'm here: Patch the tests to support pytest > 4 and hack around the inability to reference parametrized tests (test[foo]) in pytests -k expressions. [1][2] Level up ports compliance: LICENSE_FILE, USE{S} ordering, match COMMENT to setup.py:description, match pkg-descr WWW URL to setup.py:homepage QA: All tests pass on Python 2.7-3.8 [1] pytest-dev/pytest#5881 [2] pytest-dev/pytest#6177 PR: 226077 Reported by: yuri [1] Approved by: portmgr (blanket: ports compliance) net/py-suds-jurko: Bump PORTREVISION missed in ports r522860 PR: 226077 Approved by: ports-secteam (blanket(s): ports compliance, port bugfixes)
With pytest 5.1.3 on Python 3.7,
pytest -k 'test_method or test_other'
works as specified in the manual whereaspytest -k 'test_method[True] or test_other'
fails with the following traceback:The text was updated successfully, but these errors were encountered: