Skip to content

Commit

Permalink
Removes leftover testing references to SQL and arraydiff
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfullard committed Sep 9, 2024
1 parent 6695865 commit d44128e
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 56 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ env:
CHIANTI_DL_URL: https://download.chiantidatabase.org
CHIANTI_DB_VER: CHIANTI_v9.0.1_database.tar.gz
PYTEST_FLAGS: --remote-data --refdata=carsus-refdata
--cov=carsus --cov-report=xml --cov-report=html
--arraydiff --arraydiff-reference-path=carsus-refdata/arraydiff
--cov=carsus --cov-report=xml --cov-report=html
NBCONVERT_CMD: jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to html
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CMFGEN_DL_URL: http://kookaburra.phyast.pitt.edu/hillier/cmfgen_files
Expand Down
45 changes: 0 additions & 45 deletions carsus/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,9 @@ def pytest_collection_modifyitems(config, items):
skip_not_with_refdata = pytest.mark.skip(
reason="carsus-refdata folder location not specified"
)
skip_not_with_testdb = pytest.mark.skip(
reason="filename for the testing database not specified"
)
for item in items:
if "with_refdata" in item.keywords and not config.getoption("--refdata"):
item.add_marker(skip_not_with_refdata)
if "with_test_db" in item.keywords and not config.getoption("--test-db"):
item.add_marker(skip_not_with_testdb)


@pytest.fixture(scope="session")
def test_db_fname(request):
test_db_fname = request.config.getoption("--test-db")
if test_db_fname is None:
pytest.skip("--testing database was not specified")
else:
return str(Path(test_db_fname).expanduser().resolve())


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -129,37 +115,6 @@ def nndc_dirname():
return str(DATA_DIR_PATH / "nndc") # Mn-52, Ni-56


@pytest.fixture(scope="session")
def test_engine(test_db_url):
return create_engine(test_db_url)


@pytest.fixture
def test_session(test_engine, request):
# engine.echo=True
# connect to the database
connection = test_engine.connect()

# begin a non-ORM transaction
trans = connection.begin()

# bind an individual Session to the connection
session = Session(bind=connection)

def fin():
session.close()
# rollback - everything that happened with the
# Session above (including calls to commit())
# is rolled back.
trans.rollback()
# return connection to the Engine
connection.close()

request.addfinalizer(fin)

return session


@pytest.fixture(scope="session")
def refdata_path(request):
refdata_path = request.config.getoption("--refdata")
Expand Down
8 changes: 0 additions & 8 deletions docs/development/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,3 @@ A set of flags can be appended to the above command to run different kinds of te
- `--cov=carsus --cov-report=xml --cov-report=html`
Get code coverage results using the `pytest-cov <https://pytest-cov.readthedocs.io/en/latest/>`_ plugin.

- `--arraydiff-generate-path=carsus-refdata/arraydiff`
Generate reference files for tests marked with ``@pytest.mark.array_compare`` decorator and save them in the
refdata folder.

- `--arraydiff --arraydiff-reference-path=carsus-refdata/arraydiff`
Run tests marked with ``@pytest.mark.array_compare`` decorator.
The tests would look for reference files in the refdata folder which can be generated using the above option.

1 change: 0 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[pytest]
markers =
with_refdata: mark tests as needing refdata path to run
with_test_db: mark tests as needing test_db path to run

0 comments on commit d44128e

Please sign in to comment.