Skip to content
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

first python test! #478

Merged
merged 32 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1e03c4e
running pytest
edwardhartnett Sep 9, 2024
1bd300e
adding test_misc.py
edwardhartnett Sep 9, 2024
222af2b
adding jinja2
edwardhartnett Sep 9, 2024
41f8bd7
moved
edwardhartnett Sep 9, 2024
27f2977
moved
edwardhartnett Sep 9, 2024
f09f7fc
moved
edwardhartnett Sep 9, 2024
74f2abb
moved
edwardhartnett Sep 9, 2024
96b97db
moved
edwardhartnett Sep 9, 2024
f4387f0
test development
edwardhartnett Sep 9, 2024
7339fab
test development
edwardhartnett Sep 9, 2024
2718381
test development
edwardhartnett Sep 9, 2024
e6146ef
test development
edwardhartnett Sep 9, 2024
fa28e3e
adding pyproject.toml file
edwardhartnett Sep 9, 2024
1a7e502
adding pyproject.toml file
edwardhartnett Sep 9, 2024
a70884c
developing test
edwardhartnett Sep 9, 2024
2b366e8
developing test
edwardhartnett Sep 9, 2024
94c1c22
developing test
edwardhartnett Sep 9, 2024
1e82de8
developing test
edwardhartnett Sep 9, 2024
ef29dd6
developing test
edwardhartnett Sep 9, 2024
be111f2
developing test
edwardhartnett Sep 9, 2024
7b1639e
developing test
edwardhartnett Sep 9, 2024
3a6ecac
developing test
edwardhartnett Sep 9, 2024
b08816d
working on test
edwardhartnett Sep 10, 2024
61a38d1
working on test
edwardhartnett Sep 10, 2024
c1cb348
working on test
edwardhartnett Sep 10, 2024
e8a3e25
working on test
edwardhartnett Sep 10, 2024
e666776
working on test
edwardhartnett Sep 10, 2024
8675c17
working on test
edwardhartnett Sep 10, 2024
125510b
working on test
edwardhartnett Sep 10, 2024
68a671e
moving test
edwardhartnett Sep 10, 2024
29089cd
adding documentation
edwardhartnett Sep 10, 2024
e29f7ea
Merge branch 'dev-sci' into ejh_t5
edwardhartnett Sep 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/pytest_flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov coverage numpy netCDF4
pip install flake8 pytest pytest-cov coverage numpy netCDF4 jinja2
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors
flake8 . --count --select=E9,F63,F7 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
#flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: pytest
run: |
pytest
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[tool.pytest.ini_options]
addopts = "-ra --cov"
testpaths = ['tests']
pythonpath = ['.']

25 changes: 25 additions & 0 deletions tests/ush/python_utils/test_misc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

from ush.python_utils.misc import *

class TestMisc:
"""Test the misc.py functions."""

def test_uc(self):
"""Test the uppercase() function."""
assert uppercase('s') == 'S'

def test_lc(self):
"""Test the lowercase() function."""
assert lowercase('S') == 's'

def test_find_pattern_in_str(self):
"""Test the find_pattern_in_str() function."""
assert not find_pattern_in_str('.', 's')

def test_find_pattern_in_fike(self):
"""Test the find_pattern_in_file() function."""
f = open("test_misc.txt", "w")
f.write("Hello World from " + f.name)
f.close()
assert not find_pattern_in_file('H', "test_misc.txt")

Loading