-
Notifications
You must be signed in to change notification settings - Fork 45
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
Split the test suite for spec versions #20
Comments
Something useful I learnt recently—we can specify markers for all test methods in a module via assigning the pytestmark = [...] |
Okay, a proposal. By default, test methods are assumed for all versions. If test methods do not cover every version, we pin the version via a mark. # No marker
test_method_in_all_versions(...):
...
@pytest.mark.xp_version("2021.12")
test_method_only_in_one_version(...):
...
@pytest.mark.xp_version(">2021.12")
test_method_from_version(...):
...
@pytest.mark.xp_version("<=2022.09")
test_method_to_version(...):
...
@pytest.mark.xp_version(">2022.03,<=2022.09")
test_method_in_version_range(...):
... In the pytest collection hook, we can get the xp version from a custom option, fallbacking to something reasonable (e.g. only testing with the unmarked methods? assuming the most recent version?). Then we can just dynamically add the skip mark |
That sounds reasonable, but we're also going to want to have a way to do skipping inside of the test function, like
since I expect most changes will be minor things. Some changes will require separate functions, especially if they involve changing a function's signature. Relatedly, we should probably just split the stubs like |
I'll formalise my thoughts later, just to say we added versioning support to Hypothesis in HypothesisWorks/hypothesis#3456, which I'll probably take inspiration from when working on this issue. |
The 2021 version of the spec is going to be finalized soon. The test suite isn't finished yet. However, we want to have a version of the test suite that runs only against 2021, so that people can run the suite without having to worry about features that are in the 2022 draft.
We should figure out some way to enable or disable test suite features. It would also be nice to be able to do this for the extensions, so that people can easily run the test suite without the linear algebra extension, for instance. Perhaps the best way to do this is using pytest marks? Another idea would be to split the parts of the suite into submodules so that people can run
pytest array_api_tests/2021
orpytest array_api_tests/2021/extensions/linear_algebra
. For vendoring people could remove any submodules that aren't relevant.I'm guessing pytest marks will be better, but I need to investigate them to see how well suited they are for this.
The text was updated successfully, but these errors were encountered: