-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into gempyor_error_improvements
- Loading branch information
Showing
57 changed files
with
2,929 additions
and
1,109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Lint | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'flepimop/gempyor_pkg/**/*.py' | ||
pull_request: | ||
paths: | ||
- '**/*.py' | ||
branches: | ||
- main | ||
|
||
jobs: | ||
black-for-python: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | ||
env: | ||
BLACK_LINE_LENGTH: 92 | ||
BLACK_EXTEND_EXCLUDE: 'flepimop/gempyor_pkg/src/gempyor/steps_rk4.py' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
sparse-checkout: | | ||
* | ||
!documentation/ | ||
sparse-checkout-cone-mode: false | ||
- name: Determine Source | ||
run: | | ||
if [ ${{ github.event_name }} == "push" ]; then | ||
echo "BLACK_SRC=flepimop/gempyor_pkg/" >> $GITHUB_ENV | ||
else | ||
echo "BLACK_SRC=." >> $GITHUB_ENV | ||
fi | ||
- name: Black Formatter Check | ||
uses: psf/black@stable | ||
with: | ||
src: ${{ env.BLACK_SRC }} | ||
options: "--line-length ${{ env.BLACK_LINE_LENGTH }} --extend-exclude '${{ env.BLACK_EXTEND_EXCLUDE }}' --check --verbose" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
black --line-length 92 \ | ||
--extend-exclude 'flepimop/gempyor_pkg/src/gempyor/steps_rk4.py' \ | ||
--verbose . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
if which black > /dev/null 2>&1; then | ||
black --line-length 92 \ | ||
--extend-exclude 'flepimop/gempyor_pkg/src/gempyor/steps_rk4.py' \ | ||
--check --verbose . | ||
else | ||
echo "'black' is not available so python files will not be checked." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
|
||
from click.testing import CliRunner | ||
from gempyor.simulate import simulate | ||
import os | ||
|
||
# See here to test click application https://click.palletsprojects.com/en/8.1.x/testing/ | ||
# would be useful to also call the command directly | ||
|
||
|
||
def test_config_sample_2pop(): | ||
os.chdir(os.path.dirname(__file__) + "/tutorials") | ||
runner = CliRunner() | ||
result = runner.invoke(simulate, ['-c', 'config_sample_2pop.yml']) | ||
print(result.output) # useful for debug | ||
print(result.exit_code) # useful for debug | ||
print(result.exception) # useful for debug | ||
assert result.exit_code == 0 | ||
assert 'completed in' in result.output | ||
os.chdir(os.path.dirname(__file__) + "/tutorials") | ||
runner = CliRunner() | ||
result = runner.invoke(simulate, ["-c", "config_sample_2pop.yml"]) | ||
print(result.output) # useful for debug | ||
print(result.exit_code) # useful for debug | ||
print(result.exception) # useful for debug | ||
assert result.exit_code == 0 | ||
assert "completed in" in result.output | ||
|
||
|
||
def test_sample_2pop_modifiers(): | ||
os.chdir(os.path.dirname(__file__) + "/tutorials") | ||
runner = CliRunner() | ||
result = runner.invoke(simulate, ['-c', 'config_sample_2pop_modifiers.yml']) | ||
print(result.output) # useful for debug | ||
print(result.exit_code) # useful for debug | ||
print(result.exception) # useful for debug | ||
assert result.exit_code == 0 | ||
assert 'completed in' in result.output | ||
os.chdir(os.path.dirname(__file__) + "/tutorials") | ||
runner = CliRunner() | ||
result = runner.invoke(simulate, ["-c", "config_sample_2pop_modifiers.yml"]) | ||
print(result.output) # useful for debug | ||
print(result.exit_code) # useful for debug | ||
print(result.exception) # useful for debug | ||
assert result.exit_code == 0 | ||
assert "completed in" in result.output | ||
|
||
|
||
def test_simple_usa_statelevel(): | ||
os.chdir(os.path.dirname(__file__) + "/simple_usa_statelevel") | ||
runner = CliRunner() | ||
result = runner.invoke(simulate, ['-c', 'simple_usa_statelevel.yml', '-n', '1']) | ||
print(result.output) # useful for debug | ||
print(result.exit_code) # useful for debug | ||
print(result.exception) # useful for debug | ||
assert result.exit_code == 0 | ||
assert 'completed in' in result.output | ||
os.chdir(os.path.dirname(__file__) + "/simple_usa_statelevel") | ||
runner = CliRunner() | ||
result = runner.invoke(simulate, ["-c", "simple_usa_statelevel.yml", "-n", "1"]) | ||
print(result.output) # useful for debug | ||
print(result.exit_code) # useful for debug | ||
print(result.exception) # useful for debug | ||
assert result.exit_code == 0 | ||
assert "completed in" in result.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.