Skip to content

Commit

Permalink
🧪 TESTS: Entirely remove AiidaTestCase (#5372)
Browse files Browse the repository at this point in the history
This commit converts all remaining tests that used
the (deprecated) `AiidaTestCase` unittest class,
with the equivalent pytest fixtures (such as `aiida_profile_clean`).
`AiidaTestCase` is then removed, leaving one consistent method to write tests.
  • Loading branch information
chrisjsewell authored Feb 22, 2022
1 parent 139f7d2 commit b57e1b6
Show file tree
Hide file tree
Showing 85 changed files with 4,485 additions and 5,414 deletions.
117 changes: 0 additions & 117 deletions .github/system_tests/test_plugin_testcase.py

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ SYSTEM_TESTS="${GITHUB_WORKSPACE}/.github/system_tests"
pytest --cov aiida --verbose --noconftest ${SYSTEM_TESTS}/test_test_manager.py
pytest --cov aiida --verbose --noconftest ${SYSTEM_TESTS}/test_ipython_magics.py
pytest --cov aiida --verbose --noconftest ${SYSTEM_TESTS}/test_profile_manager.py
python ${SYSTEM_TESTS}/test_plugin_testcase.py # uses custom unittest test runner

# Until the `${SYSTEM_TESTS}/pytest` tests are moved within `tests` we have to run them separately and pass in the path to the
# `conftest.py` explicitly, because otherwise it won't be able to find the fixtures it provides
Expand Down
3 changes: 0 additions & 3 deletions aiida/manage/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@
# pylint: disable=wildcard-import

from .main import *
from .unittest_classes import *

__all__ = (
'PluginTestCase',
'ProfileManager',
'TemporaryProfileManager',
'TestManager',
'TestManagerError',
'TestRunner',
'get_test_backend_name',
'get_test_profile_name',
'get_user_dict',
Expand Down
6 changes: 4 additions & 2 deletions aiida/manage/tests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ def __init__(self, profile_name):
:param profile_name: Name of the profile to be loaded
"""
from aiida import load_profile
from aiida.storage.testbase import check_if_tests_can_run

self._profile = None
try:
self._profile = load_profile(profile_name)
except Exception:
raise TestManagerError(f'Unable to load test profile `{profile_name}`.')
check_if_tests_can_run()
if self._profile is None:
raise TestManagerError(f'Unable to load test profile `{profile_name}`.')
if not self._profile.is_test_profile:
raise TestManagerError(f'Profile `{profile_name}` is not a valid test profile.')

@staticmethod
def clear_profile():
Expand Down
100 changes: 0 additions & 100 deletions aiida/manage/tests/unittest_classes.py

This file was deleted.

Loading

0 comments on commit b57e1b6

Please sign in to comment.