Skip to content

Commit

Permalink
Update to maybe work with non-editable installs
Browse files Browse the repository at this point in the history
  • Loading branch information
eriknw committed Jan 25, 2024
1 parent 90b7f4c commit 9c89875
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,23 @@ popd

rapids-logger "pytest networkx using nx-cugraph backend"
pushd python/nx-cugraph
rm nx_cugraph/.coverage
env
conda list
./run_nx_tests.sh
mkdir new_directory_for_coverage
cd new_directory_for_coverage
env # XXX: delete me
conda list # XXX: delete me
../run_nx_tests.sh
# run_nx_tests.sh outputs coverage data, so check that total coverage is >0.0%
# in case nx-cugraph failed to load but fallback mode allowed the run to pass.
_coverage=$(coverage report|grep "^TOTAL")
echo "nx-cugraph coverage from networkx tests: $_coverage"
echo $_coverage | awk '{ if ($NF == "0.0%") exit 1 }'
# Ensure all algorithms were called by comparing covered lines to function lines.
# Run our tests again (they're fast enough) to add their coverage, then create coverage.json
coverage report
coverage report --data-file=.coverage --rcfile=pyproject.toml
pytest --cov=nx_cugraph --cov-append --cov-config=pyproject.toml
coverage json --data-file=.coverage
cat coverage.json
python nx_cugraph/tests/ensure_algos_covered.py
coverage report --rcfile=../pyproject.toml # XXX: delete me
pytest --pyargs nx_cugraph --cov=nx_cugraph --cov-append --cov-config=../pyproject.toml
coverage json --rcfile=../pyproject.toml
cat coverage.json # XXX: delete me
python -m nx_cugraph.tests.ensure_algos_covered
popd

rapids-logger "pytest cugraph-service (single GPU)"
Expand Down
2 changes: 1 addition & 1 deletion python/nx-cugraph/nx_cugraph/tests/ensure_algos_covered.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
coverage = json.load(f)

filenames_to_executed_lines = {
filename: set(coverage_info["executed_lines"])
filename.rsplit("nx-cugraph/", 1)[-1]: set(coverage_info["executed_lines"])
for filename, coverage_info in coverage["files"].items()
}

Expand Down
8 changes: 4 additions & 4 deletions python/nx-cugraph/run_nx_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ NETWORKX_FALLBACK_TO_NX=True \
pytest \
--pyargs networkx \
--cov=nx_cugraph \
--cov-config=pyproject.toml \
--cov-config=$(dirname $0)/pyproject.toml \
"$@"
# --cov-report= # XXX: uncomment me and move me above
coverage report \
--include="nx_cugraph/algorithms/*" \
--include="*/nx_cugraph/algorithms/*" \
--omit=__init__.py \
--show-missing \
--data-file=.coverage \
--rcfile=pyproject.toml
--rcfile=$(dirname $0)/pyproject.toml

0 comments on commit 9c89875

Please sign in to comment.