diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index bb163808f..0a48155bf 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -56,7 +56,7 @@ jobs: python-version: '3.10' - name: Run benchmarks - run: pytest --db-backend psql --benchmark-only --benchmark-json benchmark.json tests/ + run: pytest -v --db-backend psql --benchmark-only --benchmark-json benchmark.json tests/ - name: Store benchmark result uses: aiidateam/github-action-benchmark@v3 diff --git a/.github/workflows/ci-code.yml b/.github/workflows/ci-code.yml index a8d0cb9a0..dfa3cc787 100644 --- a/.github/workflows/ci-code.yml +++ b/.github/workflows/ci-code.yml @@ -104,7 +104,7 @@ jobs: AIIDA_WARN_v3: 1 # Python 3.12 has a performance regression when running with code coverage # so run code coverage only for python 3.9. - run: pytest --db-backend psql -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }} + run: pytest -v --db-backend psql -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }} - name: Upload coverage report if: matrix.python-version == 3.9 && github.repository == 'aiidateam/aiida-core' diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3277d86be..fe92b602b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -129,7 +129,7 @@ jobs: id: tests env: AIIDA_WARN_v3: 0 - run: pytest --db-backend sqlite -m 'requires_rmq' tests/ + run: pytest -sv -db-backend sqlite -m 'requires_rmq' tests/ - name: Slack notification # Always run this step (otherwise it would be skipped if any of the previous steps fail) but only if the diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c47595bae..524a625af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,7 +67,7 @@ jobs: uses: ./.github/actions/install-aiida-core - name: Run sub-set of test suite - run: pytest -s -m requires_rmq --db-backend=sqlite tests/ + run: pytest -sv -m requires_rmq --db-backend=sqlite tests/ publish: diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index d315a5069..75371449b 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -229,7 +229,7 @@ jobs: env: AIIDA_TEST_PROFILE: test_aiida AIIDA_WARN_v3: 1 - run: pytest --db-backend psql tests -m 'not nightly' tests/ + run: pytest -v --db-backend psql tests -m 'not nightly' tests/ - name: Freeze test environment run: pip freeze | sed '1d' | tee requirements-py-${{ matrix.python-version }}.txt diff --git a/.github/workflows/tests_nightly.sh b/.github/workflows/tests_nightly.sh index 2712a5124..dbb1b92a8 100755 --- a/.github/workflows/tests_nightly.sh +++ b/.github/workflows/tests_nightly.sh @@ -13,4 +13,4 @@ verdi -p test_aiida run ${SYSTEM_TESTS}/test_containerized_code.py bash ${SYSTEM_TESTS}/test_polish_workchains.sh verdi daemon stop -AIIDA_TEST_PROFILE=test_aiida pytest --db-backend psql -m nightly tests/ +AIIDA_TEST_PROFILE=test_aiida pytest -v --db-backend psql -m nightly tests/ diff --git a/tests/conftest.py b/tests/conftest.py index 129cc1e24..f110a09a1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -38,7 +38,7 @@ pytest_plugins = ['aiida.tools.pytest_fixtures', 'sphinx.testing.fixtures'] -class DbBackend(Enum): +class TestDbBackend(Enum): """Options for the '--db-backend' CLI argument""" SQLITE = 'sqlite' @@ -56,7 +56,7 @@ def pytest_collection_modifyitems(items, config): filepath_sqla = Path(__file__).parent / 'storage' / 'psql_dos' / 'migrations' / 'sqlalchemy_branch' # If the user requested the SQLite backend, automatically skip incompatible tests - if config.option.db_backend is DbBackend.SQLITE: + if config.option.db_backend is TestDbBackend.SQLITE: if config.option.markexpr != '': # Don't overwrite markers that the user already provided via '-m ' cmdline argument config.option.markexpr += ' and (not requires_psql)' @@ -91,9 +91,9 @@ def db_backend_type(string): :returns: DbBackend enum corresponding to user input string """ try: - return DbBackend(string) + return TestDbBackend(string) except ValueError: - msg = f"Invalid --db-backend option '{string}'\nMust be one of: {tuple(db.value for db in DbBackend)}" + msg = f"Invalid --db-backend option '{string}'\nMust be one of: {tuple(db.value for db in TestDbBackend)}" raise pytest.UsageError(msg) @@ -101,9 +101,9 @@ def pytest_addoption(parser): parser.addoption( '--db-backend', action='store', - default=DbBackend.SQLITE, + default=TestDbBackend.SQLITE, required=False, - help=f'Database backend to be used for tests {tuple(db.value for db in DbBackend)}', + help=f'Database backend to be used for tests {tuple(db.value for db in TestDbBackend)}', type=db_backend_type, ) @@ -124,10 +124,10 @@ def aiida_profile(pytestconfig, aiida_config, aiida_profile_factory, config_psql if 'not requires_rmq' in marker_opts or 'presto' in marker_opts: broker = None - if db_backend is DbBackend.SQLITE: + if db_backend is TestDbBackend.SQLITE: storage = 'core.sqlite_dos' config = config_sqlite_dos() - elif db_backend is DbBackend.PSQL: + elif db_backend is TestDbBackend.PSQL: storage = 'core.psql_dos' config = config_psql_dos() else: