From c4ac13b4e52f9f7ee336f26fc5729c2ea50b5bd9 Mon Sep 17 00:00:00 2001 From: Kyle Gottfried <6462596+Spitfire1900@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:18:44 -0500 Subject: [PATCH] move polluting test to its own thing --- pyproject.toml | 2 +- tests/test_autoload.py | 11 +++++++++++ tests/test_xontrib.py | 9 +-------- 3 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 tests/test_autoload.py diff --git a/pyproject.toml b/pyproject.toml index adccb80..6b83164 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ Code = "https://github.com//xontrib-pygitstatus" [project.optional-dependencies] -dev = ["pytest>=7.0", "gitpython>=3.1.43"] +dev = ["pytest>=7.0", "pytest-forked>=1.6.0", "gitpython>=3.1.43"] [build-system] diff --git a/tests/test_autoload.py b/tests/test_autoload.py new file mode 100644 index 0000000..e2bac66 --- /dev/null +++ b/tests/test_autoload.py @@ -0,0 +1,11 @@ +import pytest +from xonsh.built_ins import XonshSession +from xonsh.xontribs import xontribs_loaded + + +@pytest.mark.forked # this pollutes the pytest session +def test_autoload(xonsh_session: XonshSession): + from xonsh.main import _autoload_xontribs + + _autoload_xontribs({}) + assert 'pygitstatus' in xontribs_loaded() diff --git a/tests/test_xontrib.py b/tests/test_xontrib.py index 48fc10d..e885aad 100644 --- a/tests/test_xontrib.py +++ b/tests/test_xontrib.py @@ -48,19 +48,12 @@ def prompts(load_xontrib: abc.Callable[[str], None], yield prompts -# def test_autoload(load_xontrib): -def test_autoload(xonsh_session: XonshSession): - from xonsh.main import _autoload_xontribs - _autoload_xontribs({}) - assert 'pygitstatus' in xontribs_loaded() - - def test_clean(git_repo): with cd(git_repo): assert PromptFormatter()('{pygitstatus.clean}') == '{BOLD_GREEN}✓{RESET}' -def test_untracked(git_repo, prompts): +def test_untracked(git_repo): with cd(git_repo): Path('text.txt').touch() assert PromptFormatter()('{pygitstatus.untracked}') == '…1'