Skip to content

Commit

Permalink
build(default): fix powerlaw test
Browse files Browse the repository at this point in the history
  • Loading branch information
nialov committed Aug 2, 2023
1 parent cf19ceb commit 9ffcfd4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let

propagatedBuildInputs = [ matplotlib ];

checkInputs = [ pytestCheckHook ];
checkInputs = [ pytestCheckHook pytest ];

pythonImportsCheck = [ "ternary" ];

Expand All @@ -44,18 +44,26 @@ let

propagatedBuildInputs = [ scipy numpy matplotlib mpmath ];

checkInputs = [ pytest ];
postPatch = ''
substituteInPlace testing/test_powerlaw.py \
--replace "reference_data/" "testing/reference_data/"
'';
# --replace "reference_data/blackouts.txt" "testing/reference_data/blackouts.txt" \
# --replace "reference_data/cities.txt" "testing/reference_data/cities.txt" \
# --replace "reference_data/fires.txt" "testing/reference_data/fires.txt" \
# --replace "reference_data/flares.txt" "testing/reference_data/flares.txt" \
# --replace "reference_data/terrorism.txt" "testing/reference_data/terrorism.txt"

checkInputs = [ pytest pytestCheckHook ];

pytestFlagsArray = [ "testing" ];

# pytest is not actually used by the package for tests, it uses
# unittest instead. However pytest can run all unittest cases
# so I've just used pytest to run them with ease.
# Tests use local files which are relative to the testing directory
# so a cd into the testing directory was necessary for successful
# tests.
checkPhase = ''
cd testing
pytest
'';

pythonImportsCheck = [ "powerlaw" ];

Expand Down

0 comments on commit 9ffcfd4

Please sign in to comment.