-
Notifications
You must be signed in to change notification settings - Fork 2
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
Test suite, CLI #74
Test suite, CLI #74
Changes from all commits
e3dfde3
4ef1861
8d895e3
3b8d17b
0892d15
b6462ed
4bbb2d6
19a66dd
bc866ff
b21d787
d647473
01ea5dc
03a7322
2c9f998
b01f076
7a59797
fb49304
572be4a
2c66eb8
5dfbd32
0601105
1eb2574
8152cda
784c69e
cc2f0ac
c9d1934
4fbd76f
406b569
0eaaf27
185acae
6272de1
8371980
9ca5e33
b307741
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.tar.gz filter=lfs diff=lfs merge=lfs -text |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Test steps | ||
on: | ||
pull_request: {} | ||
push: | ||
branches: [ main ] | ||
jobs: | ||
python_run_scripts: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: ['3.9'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: install mpi | ||
run: sudo apt update && sudo apt-get install openmpi-bin openmpi-doc libopenmpi-dev | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.version }} # install the python version needed | ||
cache: "pip" | ||
- name: install icesat2-tracks using pip | ||
run: pip install . | ||
- name: install pytest | ||
run: pip install pytest pytest-xdist pytest-sugar pytest-durations | ||
- name: Run tests | ||
run: pytest --capture=sys --verbose --showlocals --tb=long --numprocesses=auto tests/test_steps.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Workflow renamed. |
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to use this hook in your local development environment. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
# Count the number of 'def test_' in test_steps.py | ||
n=$(grep -c '^def test_' tests/test_steps.py) | ||
|
||
# if n > $(nproc) then n = $(nproc) | ||
if [ $n -gt $(nproc) ]; then | ||
n=$(nproc) | ||
fi | ||
|
||
# Run your Python script | ||
pytest -n $n tests/test_steps.py | ||
|
||
# Check the exit status of the Python script | ||
if [ $? -ne 0 ]; then | ||
echo "Tests failed, aborting push." | ||
exit 1 | ||
fi |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure as my linter is not reporting an issue for this file. I think I am using ruff. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command is used to run pytest, a testing framework for Python. Here's a breakdown of each part:
pytest
: This is the command to run the pytest testing framework.--capture=sys
: This option tells pytest to capture stdout and stderr at the sys level. If your tests print to stdout or stderr, those prints will be captured and only displayed in the event of a test failure.--verbose
or-v
: This option enables verbose output, which means pytest will print more information about each test that is run.--showlocals
or-l
: This option shows local variables in tracebacks.--tb=long
: This option controls the format of the traceback that pytest prints when a test fails.long
is the most detailed format.--numprocesses=auto
or-n auto
: This option, provided by the pytest-xdist plugin, tells pytest to run tests in parallel with a number of workers equal to the number of available CPUs.tests/test_steps.py
: This is the path to the test file that pytest should run.