forked from polyanskiy/refractiveindex.info-database
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix yml files, add test, add workflow (#1)
* Test parsing of yaml files, and add workflow * fix workflow * fix workflow * fix yml formatting
- Loading branch information
1 parent
96dcbbe
commit 733e360
Showing
6 changed files
with
59 additions
and
8 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,25 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 13 * * 1" # Every Monday at 9AM EST | ||
|
||
jobs: | ||
test-parsing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install parameterized | ||
pip install pytest | ||
- name: Run tests | ||
run: pytest |
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
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,22 @@ | ||
"""Tests that all files can be parsed.""" | ||
|
||
import pathlib | ||
import unittest | ||
import yaml | ||
from parameterized import parameterized | ||
|
||
DATABASE_PATH = pathlib.Path(__file__).resolve().parent.parent / "database" | ||
PATHS = list(DATABASE_PATH.rglob("*.yml")) | ||
|
||
|
||
def custom_name_func(testcase_func, param_num, param): | ||
del param_num | ||
path = str(param.args[0]) | ||
return f"{testcase_func.__name__}{parameterized.to_safe_name(path)}" | ||
|
||
|
||
class ParseTest(unittest.TestCase): | ||
@parameterized.expand(PATHS, name_func=custom_name_func) | ||
def test_can_parse(self, path): | ||
with open(path, "r") as stream: | ||
yaml.safe_load(stream) |