Skip to content

Commit

Permalink
Merge pull request #943: filter: Reorganize Cram test files
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin authored May 24, 2022
2 parents 787ae26 + 1f3e894 commit 5916362
Show file tree
Hide file tree
Showing 39 changed files with 620 additions and 519 deletions.
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 @@ -69,19 +69,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

0 comments on commit 5916362

Please sign in to comment.