Closed MarximusMaximus closed 2 years ago
Can you show the full error you get?
Oops. Silly me. Full error attached below. Figured it out though. Turns out that some of my folder names had dashes in them, to match their example projects psuedo-repos. Changing these to underlines instead makes the issue go away. So I think it was just user error, unless sibling packages with same named files is supposed to work?
with dashes had error:
pytest --collect-only (4603064|✚1…3⚑1)
Test session starts (platform: darwin, Python 3.10.5, pytest 7.1.2, pytest-sugar 0.9.4)
cachedir: .pytest_cache
rootdir: /Volumes/src with spaces/batteries-forking-included, configfile: pyproject.toml, testpaths: .
plugins: sugar-0.9.4, html-3.1.1, subprocess-1.4.1, typeguard-2.13.3, cov-3.0.0
collecting ...
――――――――――――――――――――――――――― ERROR collecting tests/examples/conda-and-poetry/test_project_matches_template.py ―――――――――――――――――――――――――――
/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/site-packages/_pytest/runner.py:338: in from_call
result: Optional[TResult] = func()
cls = <class '_pytest.runner.CallInfo'>
duration = 0.00011304198415018618
excinfo = <ExceptionInfo ImportPathMismatchError('test_project_matches_template', '/Volumes/src with spaces/batteries-forking-in...src with spaces/batteries-forking-included/tests/examples/conda-and-poetry/test_project_matches_template.py')) tblen=4>
func = <function pytest_make_collect_report.<locals>.<lambda> at 0x10508d990>
precise_start = 235562.393913333
precise_stop = 235562.394026375
reraise = None
result = None
start = 1657665319.80064
stop = 1657665319.8007538
when = 'collect'
/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/site-packages/_pytest/runner.py:369: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
collector = <DoctestModule test_project_matches_template.py>
/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/site-packages/_pytest/doctest.py:545: in collect
module = import_path(self.path, root=self.config.rootpath)
MockAwareDocTestFinder = <class '_pytest.doctest.DoctestModule.collect.<locals>.MockAwareDocTestFinder'>
doctest = <module 'doctest' from '/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/doctest.py'>
self = <DoctestModule test_project_matches_template.py>
/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/site-packages/_pytest/pathlib.py:556: in import_path
raise ImportPathMismatchError(module_name, module_file, path)
E _pytest.pathlib.ImportPathMismatchError: ('test_project_matches_template', '/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-pip/test_project_matches_template.py', PosixPath('/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-poetry/test_project_matches_template.py'))
ignore = ''
is_same = False
mod = <module 'test_project_matches_template' from '/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-pip/test_project_matches_template.py'>
mode = <ImportMode.prepend: 'prepend'>
module_file = '/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-pip/test_project_matches_template.py'
module_name = 'test_project_matches_template'
p = PosixPath('/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-poetry/test_project_matches_template.py')
path = PosixPath('/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-poetry/test_project_matches_template.py')
pkg_path = None
pkg_root = PosixPath('/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-poetry')
root = PosixPath('/Volumes/src with spaces/batteries-forking-included')
―――――――――――――――――――――――――――――― ERROR collecting tests/examples/conda-only/test_project_matches_template.py ――――――――――――――――――――――――――――――
/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/site-packages/_pytest/runner.py:338: in from_call
result: Optional[TResult] = func()
cls = <class '_pytest.runner.CallInfo'>
duration = 8.266599616035819e-05
excinfo = <ExceptionInfo ImportPathMismatchError('test_project_matches_template', '/Volumes/src with spaces/batteries-forking-in...lumes/src with spaces/batteries-forking-included/tests/examples/conda-only/test_project_matches_template.py')) tblen=4>
func = <function pytest_make_collect_report.<locals>.<lambda> at 0x1051328c0>
precise_start = 235562.485605625
precise_stop = 235562.485688291
reraise = None
result = None
start = 1657665319.892334
stop = 1657665319.892417
when = 'collect'
/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/site-packages/_pytest/runner.py:369: in <lambda>
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
collector = <DoctestModule test_project_matches_template.py>
/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/site-packages/_pytest/doctest.py:545: in collect
module = import_path(self.path, root=self.config.rootpath)
MockAwareDocTestFinder = <class '_pytest.doctest.DoctestModule.collect.<locals>.MockAwareDocTestFinder'>
doctest = <module 'doctest' from '/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/doctest.py'>
self = <DoctestModule test_project_matches_template.py>
/opt/conda/miniforge/envs/batteries-forking-included/lib/python3.10/site-packages/_pytest/pathlib.py:556: in import_path
raise ImportPathMismatchError(module_name, module_file, path)
E _pytest.pathlib.ImportPathMismatchError: ('test_project_matches_template', '/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-pip/test_project_matches_template.py', PosixPath('/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-only/test_project_matches_template.py'))
ignore = ''
is_same = False
mod = <module 'test_project_matches_template' from '/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-pip/test_project_matches_template.py'>
mode = <ImportMode.prepend: 'prepend'>
module_file = '/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-and-pip/test_project_matches_template.py'
module_name = 'test_project_matches_template'
p = PosixPath('/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-only/test_project_matches_template.py')
path = PosixPath('/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-only/test_project_matches_template.py')
pkg_path = None
pkg_root = PosixPath('/Volumes/src with spaces/batteries-forking-included/tests/examples/conda-only')
root = PosixPath('/Volumes/src with spaces/batteries-forking-included')
<Package tests>
<Module test_project_matches_template.py>
tests/test_batteries_forking_included.py (batteries-forking-included)
<Function test_files_match__general>
Test if files in repo root and src/bfi/template match (not post_bootstrap.sh).
<Function test_files_match__post_bootstrap>
Test if post_bootstrap.sh in repo root and src/bfi/template match.
<Package conda-and-pip>
<Module test_project_matches_template.py>
tests/test_batteries_forking_included.py (batteries-forking-included)
<Function test_files_match__general>
Test if files in repo root and src/bfi/template match (not post_bootstrap.sh).
<Function test_files_match__post_bootstrap>
Test if post_bootstrap.sh in repo root and src/bfi/template match.
<Package conda-and-poetry>
<Module test_project_matches_template.py>
tests/test_batteries_forking_included.py (batteries-forking-included)
<Function test_files_match__general>
Test if files in repo root and src/bfi/template match (not post_bootstrap.sh).
<Function test_files_match__post_bootstrap>
Test if post_bootstrap.sh in repo root and src/bfi/template match.
<Package conda-only>
<Module test_project_matches_template.py>
tests/test_batteries_forking_included.py (batteries-forking-included)
<Function test_files_match__general>
Test if files in repo root and src/bfi/template match (not post_bootstrap.sh).
<Function test_files_match__post_bootstrap>
Test if post_bootstrap.sh in repo root and src/bfi/template match.
<Package batteries_forking_included>
<Module test___impl.py>
tests/src/batteries_forking_included/test___impl.py (batteries-forking-included)
<Class Test___main>
Tests loading the test suite.
<Function test___main>
Tests that the library cannot be invoked directly.
<Function test___main__shell_invocation>
Tests that the library cannot be invoked directly.
<Class Test_bfiSubcommand>
Test bfi subcommand functions.
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-None-0]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-None-1]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args1-0]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args1-1]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args2-0]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args2-1]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args3-0]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args3-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-None-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-None-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args1-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args1-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args2-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args2-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args3-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args3-1]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-None-0]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-None-1]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args1-0]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args1-1]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args2-0]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args2-1]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args3-0]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args3-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-None-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-None-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args1-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args1-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args2-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args2-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args3-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args3-1]>
_summary_
<Class Test_getVersionNumber>
Test getVersionNumber function.
<Function test_getVersionNumber_importlib>
Test getVersionNumber via importlib.
<Function test_getVersionNumber_pyproject_toml>
Test getVersionNumber via pyproject.toml.
<Function test_getVersionNumber_UNKNOWN>
Test getVersionNumber via pyproject.toml.
<Function test_getVersionNumber_BFI_VERSION>
Test getVersionNumber via pyproject.toml.
<Class Test__bfiExecute>
Test _bfiExecute function.
<Function test__bfiExecute[None-0]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[None-1]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args1-0]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args1-1]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args2-0]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args2-1]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args3-0]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args3-1]>
Test _bfiExecute with no args that returns 0.
<Module test___main__.py>
tests/src/batteries_forking_included/test___main__.py (batteries-forking-included)
<Class Test_CommandLine>
Invoke via command line.
<Function test_CommandLine_Version_FromRepoRoot>
Invoke from repo root.
<Function test_CommandLine_Version_FromSrc>
Invoked from src dir.
<Function test_CommandLine_Version_FromSrcMod>
Invoked from it's own dir.
<Function test_CommandLine_Version_FromHome>
Invoked from home dir.
<Function test_CommandLine_RunEchoFoo_FromRepoRoot>
Invoke from repo root.
<Class Test___main>
_summary_
<Function test___main[extra_args0-0-batteries_forking_included_bfiBootstrap]>
_summary_
<Function test___main[extra_args1-0-batteries_forking_included_bfiBootstrap]>
_summary_
<Function test___main[extra_args2-0-batteries_forking_included_bfiInit]>
_summary_
<Function test___main[extra_args3-0-batteries_forking_included_bfiInit]>
_summary_
<Function test___main[extra_args4-0-batteries_forking_included_bfiUpdate]>
_summary_
<Function test___main[extra_args5-0-batteries_forking_included_bfiUpdate]>
_summary_
<Function test___main[extra_args6-0-batteries_forking_included_bfiRun]>
_summary_
<Function test___main[extra_args7-0-batteries_forking_included_bfiRun]>
_summary_
<Function test___main[extra_args8-0-batteries_forking_included_bfiRun]>
_summary_
<Package bin>
<Module test_bin.py>
tests/bin/test_batteries_dash_forking_dash_included.py (batteries-forking-included)
<Class Test_CommandLine>
Invoke via command line.
<Function test_commandLine_noArgs[extra_args0-2-expected_stdout0-not_expected_stdout0]>
Invoke command line with no args.
<Function test_commandLine_noArgs[extra_args1-0-expected_stdout1-not_expected_stdout1]>
Invoke command line with no args.
<Function test_commandLine_noArgs[extra_args2-0-expected_stdout2-not_expected_stdout2]>
Invoke command line with no args.
<Function test_commandLine_noArgs[extra_args3-0-expected_stdout3-not_expected_stdout3]>
Invoke command line with no args.
---------- generated html file: file:///Volumes/src with spaces/batteries-forking-included/.reports/test-report-coverage.html -----------
---------- coverage: platform darwin, python 3.10.5-final-0 ----------
Name Stmts Miss Branch BrPart Cover Missing
--------------------------------------------------------------------------------------------------------------
src/batteries_forking_included/__impl.py 66 45 12 1 28% 77-81, 98-110, 125-129, 145-149, 159-175, 197-205, 222-224, 233-234
src/batteries_forking_included/__init__.py 1 0 0 0 100%
src/batteries_forking_included/__main__.py 54 31 6 1 43% 88-91, 111-114, 133-136, 154-157, 177-233, 248-249, 258
src/batteries_forking_included/bin/batteries-forking-included.py 25 4 4 2 79% 120->125, 174-179, 188-189
tests/__init__.py 0 0 0 0 100%
tests/conftest.py 1 0 0 0 100%
tests/examples/__init__.py 0 0 0 0 100%
tests/examples/conda-and-pip/__init__.py 0 0 0 0 100%
tests/examples/conda-and-pip/test_project_matches_template.py 55 42 28 0 16% 71-80, 88-132
tests/examples/conda-and-poetry/__init__.py 0 0 0 0 100%
tests/examples/conda-and-poetry/test_project_matches_template.py 55 42 28 0 16% 71-80, 88-132
tests/examples/conda-only/__init__.py 0 0 0 0 100%
tests/examples/conda-only/test_project_matches_template.py 55 42 28 0 16% 71-80, 88-132
tests/src/__init__.py 0 0 0 0 100%
tests/src/batteries_forking_included/__init__.py 0 0 0 0 100%
tests/src/batteries_forking_included/bin/__init__.py 0 0 0 0 100%
tests/src/batteries_forking_included/bin/test_bin.py 17 9 8 0 40% 108-119
tests/src/batteries_forking_included/test___impl.py 91 65 18 0 31% 107-108, 115-123, 174-205, 230-233, 243-257, 267-289, 299-323, 363-390
tests/src/batteries_forking_included/test___main__.py 48 33 4 0 37% 66-82, 89-104, 111-121, 128-143, 150-168, 243-262
tests/test_project_matches_template.py 55 42 28 0 16% 71-80, 88-132
--------------------------------------------------------------------------------------------------------------
TOTAL 523 355 164 4 27%
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml
======================================================== short test summary info ========================================================
FAILED tests/examples/conda-and-poetry/test_project_matches_template.py - _pytest.pathlib.ImportPathMismatchError: ('test_project_matc...
FAILED tests/examples/conda-only/test_project_matches_template.py - _pytest.pathlib.ImportPathMismatchError: ('test_project_matches_te...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Results (0.78s):
dashes changed to underscores success:
pytest --collect-only (4603064|✚1⚑1)
Test session starts (platform: darwin, Python 3.10.5, pytest 7.1.2, pytest-sugar 0.9.4)
cachedir: .pytest_cache
rootdir: /Volumes/src with spaces/batteries-forking-included, configfile: pyproject.toml, testpaths: .
plugins: sugar-0.9.4, html-3.1.1, subprocess-1.4.1, typeguard-2.13.3, cov-3.0.0
collecting ...
<Package tests>
<Module test_project_matches_template.py>
tests/test_batteries_forking_included.py (batteries-forking-included)
<Function test_files_match__general>
Test if files in repo root and src/bfi/template match (not post_bootstrap.sh).
<Function test_files_match__post_bootstrap>
Test if post_bootstrap.sh in repo root and src/bfi/template match.
<Package conda_and_pip>
<Module test_project_matches_template.py>
tests/test_batteries_forking_included.py (batteries-forking-included)
<Function test_files_match__general>
Test if files in repo root and src/bfi/template match (not post_bootstrap.sh).
<Function test_files_match__post_bootstrap>
Test if post_bootstrap.sh in repo root and src/bfi/template match.
<Package conda_and_poetry>
<Module test_project_matches_template.py>
tests/test_batteries_forking_included.py (batteries-forking-included)
<Function test_files_match__general>
Test if files in repo root and src/bfi/template match (not post_bootstrap.sh).
<Function test_files_match__post_bootstrap>
Test if post_bootstrap.sh in repo root and src/bfi/template match.
<Package conda_only>
<Module test_project_matches_template.py>
tests/test_batteries_forking_included.py (batteries-forking-included)
<Function test_files_match__general>
Test if files in repo root and src/bfi/template match (not post_bootstrap.sh).
<Function test_files_match__post_bootstrap>
Test if post_bootstrap.sh in repo root and src/bfi/template match.
<Package batteries_forking_included>
<Module test___impl.py>
tests/src/batteries_forking_included/test___impl.py (batteries-forking-included)
<Class Test___main>
Tests loading the test suite.
<Function test___main>
Tests that the library cannot be invoked directly.
<Function test___main__shell_invocation>
Tests that the library cannot be invoked directly.
<Class Test_bfiSubcommand>
Test bfi subcommand functions.
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-None-0]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-None-1]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args1-0]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args1-1]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args2-0]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args2-1]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args3-0]>
_summary_
<Function test_bfiSubcommand[bootstrap.sh-bfiBootstrap-input_args3-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-None-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-None-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args1-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args1-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args2-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args2-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args3-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiInit-input_args3-1]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-None-0]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-None-1]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args1-0]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args1-1]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args2-0]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args2-1]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args3-0]>
_summary_
<Function test_bfiSubcommand[run.sh-bfiRun-input_args3-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-None-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-None-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args1-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args1-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args2-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args2-1]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args3-0]>
_summary_
<Function test_bfiSubcommand[bfi-update.sh-bfiUpdate-input_args3-1]>
_summary_
<Class Test_getVersionNumber>
Test getVersionNumber function.
<Function test_getVersionNumber_importlib>
Test getVersionNumber via importlib.
<Function test_getVersionNumber_pyproject_toml>
Test getVersionNumber via pyproject.toml.
<Function test_getVersionNumber_UNKNOWN>
Test getVersionNumber via pyproject.toml.
<Function test_getVersionNumber_BFI_VERSION>
Test getVersionNumber via pyproject.toml.
<Class Test__bfiExecute>
Test _bfiExecute function.
<Function test__bfiExecute[None-0]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[None-1]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args1-0]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args1-1]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args2-0]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args2-1]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args3-0]>
Test _bfiExecute with no args that returns 0.
<Function test__bfiExecute[input_args3-1]>
Test _bfiExecute with no args that returns 0.
<Module test___main__.py>
tests/src/batteries_forking_included/test___main__.py (batteries-forking-included)
<Class Test_CommandLine>
Invoke via command line.
<Function test_CommandLine_Version_FromRepoRoot>
Invoke from repo root.
<Function test_CommandLine_Version_FromSrc>
Invoked from src dir.
<Function test_CommandLine_Version_FromSrcMod>
Invoked from it's own dir.
<Function test_CommandLine_Version_FromHome>
Invoked from home dir.
<Function test_CommandLine_RunEchoFoo_FromRepoRoot>
Invoke from repo root.
<Class Test___main>
_summary_
<Function test___main[extra_args0-0-batteries_forking_included_bfiBootstrap]>
_summary_
<Function test___main[extra_args1-0-batteries_forking_included_bfiBootstrap]>
_summary_
<Function test___main[extra_args2-0-batteries_forking_included_bfiInit]>
_summary_
<Function test___main[extra_args3-0-batteries_forking_included_bfiInit]>
_summary_
<Function test___main[extra_args4-0-batteries_forking_included_bfiUpdate]>
_summary_
<Function test___main[extra_args5-0-batteries_forking_included_bfiUpdate]>
_summary_
<Function test___main[extra_args6-0-batteries_forking_included_bfiRun]>
_summary_
<Function test___main[extra_args7-0-batteries_forking_included_bfiRun]>
_summary_
<Function test___main[extra_args8-0-batteries_forking_included_bfiRun]>
_summary_
<Package bin>
<Module test_bin.py>
tests/bin/test_batteries_dash_forking_dash_included.py (batteries-forking-included)
<Class Test_CommandLine>
Invoke via command line.
<Function test_commandLine_noArgs[extra_args0-2-expected_stdout0-not_expected_stdout0]>
Invoke command line with no args.
<Function test_commandLine_noArgs[extra_args1-0-expected_stdout1-not_expected_stdout1]>
Invoke command line with no args.
<Function test_commandLine_noArgs[extra_args2-0-expected_stdout2-not_expected_stdout2]>
Invoke command line with no args.
<Function test_commandLine_noArgs[extra_args3-0-expected_stdout3-not_expected_stdout3]>
Invoke command line with no args.
---------- generated html file: file:///Volumes/src with spaces/batteries-forking-included/.reports/test-report-coverage.html -----------
---------- coverage: platform darwin, python 3.10.5-final-0 ----------
Name Stmts Miss Branch BrPart Cover Missing
--------------------------------------------------------------------------------------------------------------
src/batteries_forking_included/__impl.py 66 45 12 1 28% 77-81, 98-110, 125-129, 145-149, 159-175, 197-205, 222-224, 233-234
src/batteries_forking_included/__init__.py 1 0 0 0 100%
src/batteries_forking_included/__main__.py 54 31 6 1 43% 88-91, 111-114, 133-136, 154-157, 177-233, 248-249, 258
src/batteries_forking_included/bin/batteries-forking-included.py 25 4 4 2 79% 120->125, 174-179, 188-189
tests/__init__.py 0 0 0 0 100%
tests/conftest.py 1 0 0 0 100%
tests/examples/__init__.py 0 0 0 0 100%
tests/examples/conda_and_pip/__init__.py 0 0 0 0 100%
tests/examples/conda_and_pip/test_project_matches_template.py 55 42 28 0 16% 71-80, 88-132
tests/examples/conda_and_poetry/__init__.py 0 0 0 0 100%
tests/examples/conda_and_poetry/test_project_matches_template.py 55 42 28 0 16% 71-80, 88-132
tests/examples/conda_only/__init__.py 0 0 0 0 100%
tests/examples/conda_only/test_project_matches_template.py 55 42 28 0 16% 71-80, 88-132
tests/src/__init__.py 0 0 0 0 100%
tests/src/batteries_forking_included/__init__.py 0 0 0 0 100%
tests/src/batteries_forking_included/bin/__init__.py 0 0 0 0 100%
tests/src/batteries_forking_included/bin/test_bin.py 17 9 8 0 40% 108-119
tests/src/batteries_forking_included/test___impl.py 91 65 18 0 31% 107-108, 115-123, 174-205, 230-233, 243-257, 267-289, 299-323, 363-390
tests/src/batteries_forking_included/test___main__.py 48 33 4 0 37% 66-82, 89-104, 111-121, 128-143, 150-168, 243-262
tests/test_project_matches_template.py 55 42 28 0 16% 71-80, 88-132
--------------------------------------------------------------------------------------------------------------
TOTAL 523 355 164 4 27%
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml
Results (0.63s):
Thanks @MarximusMaximus.
Can you close the issue then please?
Sure.
Thanks!
Test modules with same name in different directories, all folders and parents containing
__init__.py
, raising_pytest.pathlib.ImportPathMismatchError
.pytest 7.1.2 macOS 12.4 (21F79) on M1 Max conda 4.13.0 (miniforge)
Unfortunately I don't have a minimal example. I think maybe I might be doing something wrong and not sure where? My main pytest settings are in pyproject.toml used for pytest command line, vscode, and tox coverage env; the ones in tox.ini are for other tox envs.
Project is https://github.com/MarximusMaximus/batteries-forking-included
Workaround was to add following to tests/conftest.py:
but this seems more like a kludge than a fix.