move some tests into the main HPI package
This commit is contained in:
parent
9594caa1cd
commit
fcfc423a75
2 changed files with 22 additions and 10 deletions
8
my/tests/__init__.py
Normal file
8
my/tests/__init__.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# hmm, sadly pytest --import-mode importlib --pyargs my.core.tests doesn't work properly without __init__.py
|
||||||
|
# although it works if you run either my.core or my.core.tests.sqlite (for example) directly
|
||||||
|
# so if it gets in the way could get rid of this later?
|
||||||
|
|
||||||
|
# this particularly sucks here, because otherwise would be nice if people could also just put tests for their my. packages into their tests/ directory
|
||||||
|
# maybe some sort of hack could be used later similar to handle_legacy_import?
|
||||||
|
|
||||||
|
from my.core import __NOT_HPI_MODULE__
|
|
@ -1,9 +1,15 @@
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from more_itertools import bucket
|
from more_itertools import bucket
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import os
|
|
||||||
|
from my.core.cfg import tmp_config
|
||||||
|
|
||||||
|
from my.coding.commits import commits
|
||||||
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.skipif(
|
pytestmark = pytest.mark.skipif(
|
||||||
os.name == 'nt',
|
os.name == 'nt',
|
||||||
reason='TODO figure out how to install fd-find on Windows',
|
reason='TODO figure out how to install fd-find on Windows',
|
||||||
|
@ -11,7 +17,6 @@ pytestmark = pytest.mark.skipif(
|
||||||
|
|
||||||
|
|
||||||
def test() -> None:
|
def test() -> None:
|
||||||
from my.coding.commits import commits
|
|
||||||
all_commits = list(commits())
|
all_commits = list(commits())
|
||||||
assert len(all_commits) > 100
|
assert len(all_commits) > 100
|
||||||
|
|
||||||
|
@ -27,15 +32,14 @@ def prepare(tmp_path: Path):
|
||||||
# - bare repos
|
# - bare repos
|
||||||
# - canonical name
|
# - canonical name
|
||||||
# - caching?
|
# - caching?
|
||||||
hpi_repo_root = Path(__file__).absolute().parent.parent
|
hpi_repo_root = Path(__file__).absolute().parent.parent.parent
|
||||||
assert (hpi_repo_root / '.git').exists(), hpi_repo_root
|
assert (hpi_repo_root / '.git').exists(), hpi_repo_root
|
||||||
|
|
||||||
class commits:
|
class config:
|
||||||
emails = {'karlicoss@gmail.com'}
|
class commits:
|
||||||
names = {'Dima'}
|
emails = {'karlicoss@gmail.com'}
|
||||||
roots = [hpi_repo_root]
|
names = {'Dima'}
|
||||||
|
roots = [hpi_repo_root]
|
||||||
|
|
||||||
from my.core.cfg import tmp_config
|
with tmp_config(modules='my.coding.commits', config=config):
|
||||||
with tmp_config() as config:
|
|
||||||
config.commits = commits
|
|
||||||
yield
|
yield
|
Loading…
Add table
Reference in a new issue