Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter: Reorganize Cram test files #943

Merged
merged 3 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- run: conda info
- run: conda list
- run: pytest -c pytest.python3.ini --cov=augur
- run: cram --shell=/bin/bash tests/functional/*.t tests/builds/*.t
- run: cram --shell=/bin/bash tests/
env:
AUGUR: coverage run -a ${{ github.workspace }}/bin/augur
COVERAGE_FILE: ${{ github.workspace }}/.coverage
Expand Down
6 changes: 3 additions & 3 deletions augur/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ def read_metadata(metadata_file, id_columns=("strain", "name"), chunk_size=None)

For standard use, request a metadata file and get a pandas DataFrame.

>>> read_metadata("tests/functional/filter/metadata.tsv").index.values[0]
>>> read_metadata("tests/functional/filter/data/metadata.tsv").index.values[0]
'COL/FLR_00024/2015'

Requesting an index column that doesn't exist should produce an error.

>>> read_metadata("tests/functional/filter/metadata.tsv", id_columns=("Virus name",))
>>> read_metadata("tests/functional/filter/data/metadata.tsv", id_columns=("Virus name",))
Traceback (most recent call last):
...
Exception: None of the possible id columns (('Virus name',)) were found in the metadata's columns ('strain', 'virus', 'accession', 'date', 'region', 'country', 'division', 'city', 'db', 'segment', 'authors', 'url', 'title', 'journal', 'paper_url')

We also allow iterating through metadata in fixed chunk sizes.

>>> for chunk in read_metadata("tests/functional/filter/metadata.tsv", chunk_size=5):
>>> for chunk in read_metadata("tests/functional/filter/data/metadata.tsv", chunk_size=5):
... print(chunk.shape)
...
(5, 14)
Expand Down
2 changes: 1 addition & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ python3 -m pytest -c pytest.python3.ini $coverage_arg "$@"
# Only run functional tests if we are not running a subset of tests for pytest.
if [ "$partial_test" = 0 ]; then
echo "Running functional tests with cram"
cram --shell=/bin/bash tests/functional/*.t tests/builds/*.t
cram --shell=/bin/bash tests/
else
echo "Skipping functional tests when running a subset of unit tests"
fi
Expand Down
Loading