-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: move to hatch scripts for tests, move to pytest + CI (#90)
* Fix: move to hatch scripts for tests and move to pytest * Fix: setup ci for tests * Fix: python version in quotes
- Loading branch information
Showing
6 changed files
with
77 additions
and
37 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,20 @@ | ||
name: Run pyos meta tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: Install Hatch | ||
run: pipx install hatch | ||
- name: Run tests | ||
run: hatch run test:run-tests |
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,17 @@ | ||
# Development Guide | ||
|
||
## Packaging | ||
|
||
pyosMeta uses hatch and hatchling as it's build back end. | ||
|
||
## Running tests | ||
|
||
To install tests: | ||
|
||
`python -m pip install ".[tests]"` | ||
|
||
We use Hatch scripts to automate workflows. | ||
|
||
To run tests, you can use: | ||
|
||
`hatch run test:run-tests` |
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,27 +1,22 @@ | ||
from unittest import TestCase | ||
import pytest | ||
|
||
from pyosmeta.parse_issues import parse_user_names | ||
|
||
|
||
class TestParseUserNames(TestCase): | ||
def setUp(self) -> None: | ||
self.name1 = "Test User (@test1user)" | ||
self.name2 = "(@test2user)" | ||
self.name3 = "Test (user) 3 (@test3user)" | ||
self.name4 = "@test4user" | ||
|
||
def test_parse_1(self): | ||
d = {"name": "Test User", "github_username": "test1user"} | ||
self.assertDictEqual(d, parse_user_names(self.name1)) | ||
|
||
def test_parse_2(self): | ||
d = {"name": "", "github_username": "test2user"} | ||
self.assertDictEqual(d, parse_user_names(self.name2)) | ||
|
||
def test_parse_3(self): | ||
d = {"name": "Test user 3", "github_username": "test3user"} | ||
self.assertDictEqual(d, parse_user_names(self.name3)) | ||
|
||
def test_parse_4(self): | ||
d = {"name": "", "github_username": "test4user"} | ||
self.assertDictEqual(d, parse_user_names(self.name4)) | ||
@pytest.mark.parametrize( | ||
"name, expected_result", | ||
[ | ||
( | ||
"Test User (@test1user)", | ||
{"name": "Test User", "github_username": "test1user"}, | ||
), | ||
("(@test2user)", {"name": "", "github_username": "test2user"}), | ||
( | ||
"Test (user) 3 (@test3user)", | ||
{"name": "Test user 3", "github_username": "test3user"}, | ||
), | ||
("@test4user", {"name": "", "github_username": "test4user"}), | ||
], | ||
) | ||
def test_parse_user_names(name, expected_result): | ||
assert parse_user_names(name) == expected_result |