-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pytest, Existing GitLfs garnet-data repo connection and Code Coverage…
… Initialization (#4) Updates in tests, pytest, codecoverage and garnet-data existing repository configurations
- Loading branch information
Showing
21 changed files
with
303 additions
and
182 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: [next, qa, main] | ||
tags: ['v*'] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: environment.yml | ||
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }} | ||
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }} | ||
- name: install garnet_reduction | ||
run: | | ||
python -m pip install -e . | ||
- name: run unit tests | ||
run: | | ||
echo "running unit tests" | ||
xvfb-run --server-args="-screen 0 1920x1080x24" -a python -m pytest --cov=src --cov-report=xml --cov-report=term-missing | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4.0.1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: neutrons/garnet_reduction |
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,6 @@ | ||
[submodule "tests/data/garnet-data"] | ||
path = tests/data/garnet-data | ||
url = https://code.ornl.gov/sns-hfir-scse/infrastructure/test-data/garnet-data.git | ||
branch = main | ||
[submodule "garnet-data"] | ||
update = merge |
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 +1,23 @@ | ||
#  | ||
|
||
|
||
### Getting started | ||
|
||
Create conda environment | ||
```bash | ||
conda env create -f environment.yml | ||
``` | ||
|
||
Activate garnet environment | ||
```bash | ||
conda activate garnet_reduction | ||
``` | ||
|
||
Install in editable mode for developlment | ||
```bash | ||
python -m pip install -e . | ||
``` | ||
|
||
|
||
[](https://github.com/neutrons/garnet_reduction/actions/workflows/garnetreduction.yml/) | ||
[](https://codecov.io/gh/neutrons/garnet_reduction) |
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,10 @@ | ||
# Configuration file for codecov reporting code coverage | ||
|
||
# Percentage drop allowed | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
# base on last build, but allow drop of upto this percent | ||
target: 80.0 | ||
threshold: 2.0 |
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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,47 @@ | ||
"""pytest config""" | ||
|
||
import os | ||
|
||
import pytest | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption("--all", action="store_true", default=False, help="run slow tests") | ||
|
||
|
||
def pytest_collection_modifyitems(config, items): | ||
if config.getoption("--all"): | ||
# --all: do not skip slow tests | ||
return | ||
skip_slow = pytest.mark.skip(reason="need --all option to run") | ||
for item in items: | ||
if "resources_intensive" in item.keywords: | ||
item.add_marker(skip_slow) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def has_sns_mount(): | ||
"""Fixture that returns True if the SNS data mount (e.g CORELLI shared) is available""" | ||
sns_dir = "/SNS/CORELLI/shared/" | ||
return os.path.exists(sns_dir) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def has_hfir_mount(): | ||
"""Fixture that returns True if the HFIR data mount (e.g HB3A shared) is available""" | ||
hfir_dir = "/HFIR/HB3A/shared/" | ||
return os.path.exists(hfir_dir) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def has_datarepo(): | ||
"""Fixture that returns True if the datarepo_dir is available""" | ||
readme_data = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "garnet-data", "README.md") | ||
return os.path.exists(readme_data) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def datarepo_dir(): | ||
"""Return the directory **absolute** paths for test data.""" | ||
root_data = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "garnet-data") | ||
return root_data |
Submodule garnet-data
added at
74cdac
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.