From 2c251285ede7eb4b10084b3ce01d5285ddb28e0b Mon Sep 17 00:00:00 2001 From: Yujia Hu Date: Fri, 23 Jan 2026 10:16:09 -0500 Subject: [PATCH] Revert "testing: reorg of test infra for maintainability and scalability" --- {tests/linting => LabGym/tests}/INIT.sh | 2 +- .../tests}/Notes.importtime.txt | 0 ...es.opencv-python-and-coverage-warnings.txt | 0 .../notes => LabGym/tests}/Notes.pytest.txt | 0 .../integration => LabGym/tests}/__init__.py | 0 {tests => LabGym/tests}/coveragerc | 0 {tests/unit => LabGym/tests}/exitstatus.py | 0 .../notes => LabGym/tests}/pylint.Notes.txt | 0 {tests/linting => LabGym/tests}/pylint.sh | 2 +- {tests/linting => LabGym/tests}/pylintrc | 0 {tests/linting => LabGym/tests}/pylintrc- | 0 pytest.ini => LabGym/tests/pytest.ini | 7 --- {tests/unit => LabGym/tests}/test___main__.py | 0 .../tests}/test_central_logging.py | 0 {tests/unit => LabGym/tests}/test_config.py | 0 .../tests}/test_config/bad.yaml | Bin .../unit => LabGym/tests}/test_myargparse.py | 0 .../unit => LabGym/tests}/test_mylogging.py | 0 .../tests}/test_mypkg_resources.py | 0 {tests/unit => LabGym/tests}/test_mywx.py | 0 {tests/unit => LabGym/tests}/test_pkghash.py | 0 {tests/unit => LabGym/tests}/test_probes.py | 0 .../tests}/test_probes/cacert.fouled.pem | 0 .../tests}/test_probes/cacert.pem | 0 .../tests}/test_registration.py | 0 .../test_registration/registration.yaml | 0 .../tests}/test_userdata_survey.py | 0 .../tests/tmp.pylint/.gitkeep | 0 noxfile.py | 2 +- tests/conftest.py | 45 ------------------ tests/{unit => }/test_load.py | 0 tests/{unit => }/test_main.py | 0 32 files changed, 3 insertions(+), 55 deletions(-) rename {tests/linting => LabGym/tests}/INIT.sh (92%) rename {tests/notes => LabGym/tests}/Notes.importtime.txt (100%) rename {tests/notes => LabGym/tests}/Notes.opencv-python-and-coverage-warnings.txt (100%) rename {tests/notes => LabGym/tests}/Notes.pytest.txt (100%) rename {tests/integration => LabGym/tests}/__init__.py (100%) rename {tests => LabGym/tests}/coveragerc (100%) rename {tests/unit => LabGym/tests}/exitstatus.py (100%) rename {tests/notes => LabGym/tests}/pylint.Notes.txt (100%) rename {tests/linting => LabGym/tests}/pylint.sh (99%) rename {tests/linting => LabGym/tests}/pylintrc (100%) rename {tests/linting => LabGym/tests}/pylintrc- (100%) rename pytest.ini => LabGym/tests/pytest.ini (68%) rename {tests/unit => LabGym/tests}/test___main__.py (100%) rename {tests/unit => LabGym/tests}/test_central_logging.py (100%) rename {tests/unit => LabGym/tests}/test_config.py (100%) rename {tests/unit => LabGym/tests}/test_config/bad.yaml (100%) rename {tests/unit => LabGym/tests}/test_myargparse.py (100%) rename {tests/unit => LabGym/tests}/test_mylogging.py (100%) rename {tests/unit => LabGym/tests}/test_mypkg_resources.py (100%) rename {tests/unit => LabGym/tests}/test_mywx.py (100%) rename {tests/unit => LabGym/tests}/test_pkghash.py (100%) rename {tests/unit => LabGym/tests}/test_probes.py (100%) rename {tests/unit => LabGym/tests}/test_probes/cacert.fouled.pem (100%) rename {tests/unit => LabGym/tests}/test_probes/cacert.pem (100%) rename {tests/unit => LabGym/tests}/test_registration.py (100%) rename {tests/unit => LabGym/tests}/test_registration/registration.yaml (100%) rename {tests/unit => LabGym/tests}/test_userdata_survey.py (100%) rename tests/unit/__init__.py => LabGym/tests/tmp.pylint/.gitkeep (100%) delete mode 100644 tests/conftest.py rename tests/{unit => }/test_load.py (100%) rename tests/{unit => }/test_main.py (100%) diff --git a/tests/linting/INIT.sh b/LabGym/tests/INIT.sh similarity index 92% rename from tests/linting/INIT.sh rename to LabGym/tests/INIT.sh index 50df101c..1475db15 100644 --- a/tests/linting/INIT.sh +++ b/LabGym/tests/INIT.sh @@ -10,7 +10,7 @@ IS_VENV () { [ -n "$VIRTUAL_ENV+1" ]; } # works in sh, bash, and zsh AWK () { awk "$@"; } -PYFILES=$(cd ../../LabGym && echo *.py) +PYFILES=$(cd .. && echo *.py) # printf "%s: %s\n" "\$PYFILES" "$PYFILES" return diff --git a/tests/notes/Notes.importtime.txt b/LabGym/tests/Notes.importtime.txt similarity index 100% rename from tests/notes/Notes.importtime.txt rename to LabGym/tests/Notes.importtime.txt diff --git a/tests/notes/Notes.opencv-python-and-coverage-warnings.txt b/LabGym/tests/Notes.opencv-python-and-coverage-warnings.txt similarity index 100% rename from tests/notes/Notes.opencv-python-and-coverage-warnings.txt rename to LabGym/tests/Notes.opencv-python-and-coverage-warnings.txt diff --git a/tests/notes/Notes.pytest.txt b/LabGym/tests/Notes.pytest.txt similarity index 100% rename from tests/notes/Notes.pytest.txt rename to LabGym/tests/Notes.pytest.txt diff --git a/tests/integration/__init__.py b/LabGym/tests/__init__.py similarity index 100% rename from tests/integration/__init__.py rename to LabGym/tests/__init__.py diff --git a/tests/coveragerc b/LabGym/tests/coveragerc similarity index 100% rename from tests/coveragerc rename to LabGym/tests/coveragerc diff --git a/tests/unit/exitstatus.py b/LabGym/tests/exitstatus.py similarity index 100% rename from tests/unit/exitstatus.py rename to LabGym/tests/exitstatus.py diff --git a/tests/notes/pylint.Notes.txt b/LabGym/tests/pylint.Notes.txt similarity index 100% rename from tests/notes/pylint.Notes.txt rename to LabGym/tests/pylint.Notes.txt diff --git a/tests/linting/pylint.sh b/LabGym/tests/pylint.sh similarity index 99% rename from tests/linting/pylint.sh rename to LabGym/tests/pylint.sh index 2b1ebded..373b2ed6 100644 --- a/tests/linting/pylint.sh +++ b/LabGym/tests/pylint.sh @@ -10,7 +10,7 @@ source INIT.sh -PYFILES=$(echo ../../LabGym/*.py ../../LabGym/mywx/*.py) +PYFILES=$(echo ../*.py ../mywx/*.py) OP=pylint # default OP while [ $# -gt 0 ]; do diff --git a/tests/linting/pylintrc b/LabGym/tests/pylintrc similarity index 100% rename from tests/linting/pylintrc rename to LabGym/tests/pylintrc diff --git a/tests/linting/pylintrc- b/LabGym/tests/pylintrc- similarity index 100% rename from tests/linting/pylintrc- rename to LabGym/tests/pylintrc- diff --git a/pytest.ini b/LabGym/tests/pytest.ini similarity index 68% rename from pytest.ini rename to LabGym/tests/pytest.ini index f75122ee..385a3fef 100644 --- a/pytest.ini +++ b/LabGym/tests/pytest.ini @@ -1,12 +1,5 @@ # pytest.ini [pytest] -testpaths = tests - -markers = - slow: marks tests as slow - integration: markts integration tests - gui: marks tests requiring wx - # Avoid two coverage warnings from detectron2's import of cv2. # (see Notes.opencv-python-and-coverage-warnings.txt) filterwarnings = diff --git a/tests/unit/test___main__.py b/LabGym/tests/test___main__.py similarity index 100% rename from tests/unit/test___main__.py rename to LabGym/tests/test___main__.py diff --git a/tests/unit/test_central_logging.py b/LabGym/tests/test_central_logging.py similarity index 100% rename from tests/unit/test_central_logging.py rename to LabGym/tests/test_central_logging.py diff --git a/tests/unit/test_config.py b/LabGym/tests/test_config.py similarity index 100% rename from tests/unit/test_config.py rename to LabGym/tests/test_config.py diff --git a/tests/unit/test_config/bad.yaml b/LabGym/tests/test_config/bad.yaml similarity index 100% rename from tests/unit/test_config/bad.yaml rename to LabGym/tests/test_config/bad.yaml diff --git a/tests/unit/test_myargparse.py b/LabGym/tests/test_myargparse.py similarity index 100% rename from tests/unit/test_myargparse.py rename to LabGym/tests/test_myargparse.py diff --git a/tests/unit/test_mylogging.py b/LabGym/tests/test_mylogging.py similarity index 100% rename from tests/unit/test_mylogging.py rename to LabGym/tests/test_mylogging.py diff --git a/tests/unit/test_mypkg_resources.py b/LabGym/tests/test_mypkg_resources.py similarity index 100% rename from tests/unit/test_mypkg_resources.py rename to LabGym/tests/test_mypkg_resources.py diff --git a/tests/unit/test_mywx.py b/LabGym/tests/test_mywx.py similarity index 100% rename from tests/unit/test_mywx.py rename to LabGym/tests/test_mywx.py diff --git a/tests/unit/test_pkghash.py b/LabGym/tests/test_pkghash.py similarity index 100% rename from tests/unit/test_pkghash.py rename to LabGym/tests/test_pkghash.py diff --git a/tests/unit/test_probes.py b/LabGym/tests/test_probes.py similarity index 100% rename from tests/unit/test_probes.py rename to LabGym/tests/test_probes.py diff --git a/tests/unit/test_probes/cacert.fouled.pem b/LabGym/tests/test_probes/cacert.fouled.pem similarity index 100% rename from tests/unit/test_probes/cacert.fouled.pem rename to LabGym/tests/test_probes/cacert.fouled.pem diff --git a/tests/unit/test_probes/cacert.pem b/LabGym/tests/test_probes/cacert.pem similarity index 100% rename from tests/unit/test_probes/cacert.pem rename to LabGym/tests/test_probes/cacert.pem diff --git a/tests/unit/test_registration.py b/LabGym/tests/test_registration.py similarity index 100% rename from tests/unit/test_registration.py rename to LabGym/tests/test_registration.py diff --git a/tests/unit/test_registration/registration.yaml b/LabGym/tests/test_registration/registration.yaml similarity index 100% rename from tests/unit/test_registration/registration.yaml rename to LabGym/tests/test_registration/registration.yaml diff --git a/tests/unit/test_userdata_survey.py b/LabGym/tests/test_userdata_survey.py similarity index 100% rename from tests/unit/test_userdata_survey.py rename to LabGym/tests/test_userdata_survey.py diff --git a/tests/unit/__init__.py b/LabGym/tests/tmp.pylint/.gitkeep similarity index 100% rename from tests/unit/__init__.py rename to LabGym/tests/tmp.pylint/.gitkeep diff --git a/noxfile.py b/noxfile.py index 6319fed8..e960e264 100644 --- a/noxfile.py +++ b/noxfile.py @@ -52,7 +52,7 @@ def tests(session:nox.Session): # package and test dependencies session.install("-e", ".") - session.install("pytest", "coverage") + session.install("pytest") session.run("pytest", "-q") diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index a4e59139..00000000 --- a/tests/conftest.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -/tests/conftest.py - -Shared pytest fixtures for LabGym tests -""" - -# Standard library imports -import sys - -# Related third party imports -import pytest - -@pytest.fixture(scope="session") -def wx_app(): - from LabGym.ui.gui import wxutils - import wx - app = wx.App() - yield app - - -@pytest.fixture -def mock_argv(monkeypatch): - monkeypatch.setattr(sys, 'argv', ['LabGym']) - - -@pytest.fixture -def sample_greyscale_frame(): - import numpy as np - import cv2 - frame = np.full((100, 100), 200, dtype = np.uint8) - cv2.circle(frame, (50, 50), 15, 50, -1) - return frame - -@pytest.fixture -def sample_video_frames(): - import numpy as np - import cv2 - frames = [] - - for i in range(60): - frame = np.full((100, 100), 200, dtype = np.uint8) - cv2.circle(frame, (20 + i % 60, 50), 15, 50, -1) - frames.append(frame) - - return frames \ No newline at end of file diff --git a/tests/unit/test_load.py b/tests/test_load.py similarity index 100% rename from tests/unit/test_load.py rename to tests/test_load.py diff --git a/tests/unit/test_main.py b/tests/test_main.py similarity index 100% rename from tests/unit/test_main.py rename to tests/test_main.py