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

Run the test suite in a random order #2287

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/testing-all-oses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
fail-fast: false
matrix:
os: ["macos-13", "macos-14", "ubuntu-latest"]
order: ["normal", "reverse"]
steps:
- uses: actions/checkout@v4
- name: Build requirements.txt file
Expand All @@ -29,6 +28,7 @@ jobs:
sed -e "s/menuinst.*//" |
sed -e "s/.*://" > requirements.tmp.txt
cat requirements.d/development.txt >> requirements.tmp.txt
echo "pytest-randomly" >> requirements.tmp.txt
Copy link
Member

@ReimarBauer ReimarBauer Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We maybe should add this to the https://github.com/Open-MSS/MSS/blob/develop/requirements.d/development.txt

or does it once it is installed immeadiatly change to randomly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, once it is installed it will randomize the test order by default, unless you pass --randomly-dont-reorganize. That is why I decided to only add it in this workflow, until the test suite fully works with it.

sed -e '/^$/d' -e '/^#.*$/d' requirements.tmp.txt > requirements.txt
rm requirements.tmp.txt
cat requirements.txt
Expand All @@ -50,4 +50,4 @@ jobs:
# TODO: fix those tests and drop the ignores
run: micromamba run -n ci env QT_QPA_PLATFORM=offscreen pytest -v -n logical --durations=20 --cov=mslib
--ignore=tests/_test_msui/test_sideview.py --ignore=tests/_test_msui/test_topview.py --ignore=tests/_test_msui/test_wms_control.py
${{ (matrix.order == 'normal' && ' ') || (matrix.order == 'reverse' && '--reverse') }} tests
tests
11 changes: 4 additions & 7 deletions tests/_test_mswms/test_wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
import sys
import os
from shutil import move

Expand Down Expand Up @@ -388,11 +387,11 @@ def test_import_error(self):
assert mslib.mswms.wms.mswms_settings.__file__ is not None
assert mslib.mswms.wms.mswms_auth.__file__ is not None

@pytest.mark.skipif(
sys.platform == "darwin",
reason="""\
@pytest.mark.skip("""\
There is a race condition between modifying with ncap2 and asserting that the file changed where the server might not
see the change before the request is made, which leads to a failure of the following assert.

This test fails on macOS 14 and can also fail on Linux when the pytest test order is randomized.
""".strip(),
)
def test_files_changed(self):
Expand Down Expand Up @@ -436,9 +435,7 @@ def do_test():
"data_access", new=watch_access):
do_test()

@pytest.mark.skipif(
sys.platform == "darwin",
reason="""\
@pytest.mark.skip("""\
This test changes global variables (e.g. DOCS_LOCATION) which can affect other tests depending on test order
(e.g. tests/_test_mswms/test_mss_plot_driver.py::Test_VSec::test_VS_gallery_template fails consistently in reverse order
on macOS 14).
Expand Down