Skip to content

Commit

Permalink
CI: Switch from aiida-testing to aiida-test-cache
Browse files Browse the repository at this point in the history
aiida-testing pytest plugin has been renamed to aiida-test-cache
and published on PyPI we can drop the dependency on Git repo.
The released version should be fully backwards compatible,
see release notes:
https://github.com/aiidateam/aiida-test-cache/releases/tag/v0.0.1
  • Loading branch information
danielhollas committed Dec 6, 2024
1 parent e89b52a commit bc678dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,11 @@ jobs:
- name: Install python dependencies
run: |
pip install --upgrade wheel setuptools
pip install git+https://github.com/aiidateam/aiida-testing.git@main
pip install aiida-test-cache~=0.0.1
pip install --no-deps git+https://github.com/aiidateam/aiida-common-workflows.git@master
pip install .[testing,graphs]
pip install ${{ matrix.aiida.version }} ${{ matrix.masci-tools.version }}
pip install ${{ matrix.bokeh-version }} ${{ matrix.mpl-version }}
reentry scan || true
- name: Run pytest
run: |
Expand Down
20 changes: 7 additions & 13 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

CONFTEST_LOCATION = Path(__file__).parent.resolve()

# aiida_testing.mock_codes in development, not yet a stable dependency
# aiida-test-cache package is in development, not yet a stable dependency
# therefore we try to import it and if it fails we skip tests with it

RUN_REGRESSION_TESTS = True
try:
import aiida_testing
import aiida_test_cache
except ImportError:
print('AiiDA-testing not in path. Running without regression tests for Workchains and CalcJobs.')
print('aiida-test-cache package not installed. Running without regression tests for Workchains and CalcJobs.')
RUN_REGRESSION_TESTS = False

pytest_plugins = ['aiida.manage.tests.pytest_fixtures', 'masci_tools.testing.bokeh']
Expand All @@ -36,30 +36,24 @@ def pytest_configure(config):
We make them all lowercaps as convention
"""
config.addinivalue_line('markers',
'regression_test: test using the aiida-testing plugin for workflow regression tests')
'regression_test: test using the aiida-test-cache plugin for workflow regression tests')


def pytest_collection_modifyitems(session, config, items):
"""After test collection modify collection.
Skip regression test if aiida-tesing is not there
Skip regression tests if aiida-test-cache is not there
"""
import aiida

skip_regression = pytest.mark.skip(
reason='Workflow regression test is skipped, because aiida-testing is not available')
# aiida_version_skip = pytest.mark.skipif(
# aiida.get_version().startswith('2.'),
# reason='Workflow regression test is skipped, because aiida-testing is not compatible with AiiDA 2.0')
reason='Workflow regression test is skipped, because aiida-test-cache is not available')

regression_items = [item for item in items if 'regression_test' in item.keywords]
if not RUN_REGRESSION_TESTS:
for item in regression_items:
item.add_marker(skip_regression)

# for item in regression_items:
# item.add_marker(aiida_version_skip)


@pytest.fixture(scope='function')
def fixture_sandbox():
Expand Down Expand Up @@ -767,7 +761,7 @@ def load_cache(absolute_archive_path): # pylint: disable=redefined-outer-name

def _load_cache(archive_path):
#TODO: private import not good
from aiida_testing.archive_cache._utils import load_node_archive # pylint: disable=import-error
from aiida_test_cache.archive_cache._utils import load_node_archive # pylint: disable=import-error
full_archive_path = absolute_archive_path(archive_path, overwrite=False)
# check and load export
export_exists = os.path.isfile(full_archive_path)
Expand Down

0 comments on commit bc678dd

Please sign in to comment.