-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Enhance existing repo with improved meta data (#8)
- Loading branch information
Showing
11 changed files
with
305 additions
and
198 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 |
---|---|---|
@@ -1,37 +1,46 @@ | ||
import xml.etree.ElementTree as ET | ||
from os import system, unlink | ||
from os.path import dirname, join | ||
|
||
from phulpy import task | ||
|
||
|
||
@task | ||
def test(phulpy): | ||
phulpy.start(['lint', 'typecheck', 'unit_test']) | ||
phulpy.start(["lint", "typecheck", "unit_test"]) | ||
|
||
|
||
@task | ||
def lint(phulpy): | ||
result = system('flake8 pydantic_mongo') | ||
if result: | ||
raise Exception('lint test failed') | ||
pydantic_mongo_dir = "pydantic_mongo" | ||
for cmd, message in ( | ||
(f"flake8 {pydantic_mongo_dir}", "lint test failed"), | ||
(f"isort {pydantic_mongo_dir} --profile black --check", "please run isort!"), | ||
(f"black {pydantic_mongo_dir} --check", "please run black!"), | ||
): | ||
result = system(cmd) | ||
if result: | ||
raise Exception("lint test failed") | ||
|
||
|
||
@task | ||
def unit_test(phulpy): | ||
result = system( | ||
'pytest --cov-report term-missing' | ||
+ ' --cov-report xml --cov=pydantic_mongo test' | ||
"pytest --cov-report term-missing" | ||
+ " --cov-report xml --cov=pydantic_mongo test" | ||
) | ||
if result: | ||
raise Exception('Unit tests failed') | ||
coverage_path = join(dirname(__file__), 'coverage.xml') | ||
raise Exception("Unit tests failed") | ||
coverage_path = join(dirname(__file__), "coverage.xml") | ||
xml = ET.parse(coverage_path).getroot() | ||
if float(xml.get('line-rate')) < 1: | ||
raise Exception('Unit test is not fully covered') | ||
if float(xml.get("line-rate")) < 1: | ||
raise Exception("Unit test is not fully covered") | ||
|
||
|
||
@task | ||
def typecheck(phulpy): | ||
result = system(r'find ./pydantic_mongo -name "*.py" -exec mypy --ignore-missing-imports --follow-imports=skip --strict-optional {} \+') | ||
result = system( | ||
r'find ./pydantic_mongo -name "*.py" -exec mypy --ignore-missing-imports --follow-imports=skip --strict-optional {} \+' | ||
) | ||
if result: | ||
raise Exception('lint test failed') | ||
raise Exception("lint test failed") |
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,3 +1,3 @@ | ||
from .abstract_repository import AbstractRepository # noqa | ||
from .fields import ObjectIdField # noqa | ||
from .version import __version__ # noqa | ||
from .abstract_repository import AbstractRepository # noqa | ||
from .fields import ObjectIdField # noqa | ||
from .version import __version__ # noqa |
Oops, something went wrong.