diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..6d8a5af --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[pytest] +norecursedirs=tests/helpers \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..501ed17 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +import os +sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers')) \ No newline at end of file diff --git a/tests/helpers/__init__.py b/tests/helpers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/helpers/util.py b/tests/helpers/util.py new file mode 100644 index 0000000..faed6e1 --- /dev/null +++ b/tests/helpers/util.py @@ -0,0 +1,11 @@ +""" Utility functions for tests +""" +from fediblockhole import setup_argparse, augment_args + +def shim_argparse(testargv: list=[], tomldata: str=None): + """Helper function to parse test args + """ + ap = setup_argparse() + args = ap.parse_args(testargv) + args = augment_args(args, tomldata) + return args \ No newline at end of file diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 4e6f355..46b5748 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -1,15 +1,8 @@ """Test the commandline defined parameters correctly """ +from util import shim_argparse from fediblockhole import setup_argparse, augment_args -def shim_argparse(testargv: list=[], tomldata: str=None): - """Helper function to parse test args - """ - ap = setup_argparse() - args = ap.parse_args(testargv) - args = augment_args(args, tomldata) - return args - def test_cmdline_no_configfile(): """ Test bare command with no configfile """ diff --git a/tests/test_configfile.py b/tests/test_configfile.py index d52a425..4b2c1e7 100644 --- a/tests/test_configfile.py +++ b/tests/test_configfile.py @@ -1,15 +1,8 @@ """Test the config file is loading parameters correctly """ +from util import shim_argparse from fediblockhole import setup_argparse, augment_args -def shim_argparse(testargv: list=[], tomldata: str=None): - """Helper function to parse test args - """ - ap = setup_argparse() - args = ap.parse_args(testargv) - args = augment_args(args, tomldata) - return args - def test_parse_tomldata(): tomldata = """ # Test TOML config for FediBlockHole