Skip to content

Commit

Permalink
move polluting test to its own thing
Browse files Browse the repository at this point in the history
  • Loading branch information
Spitfire1900 committed Dec 4, 2024
1 parent b53a781 commit c4ac13b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
11 changes: 11 additions & 0 deletions tests/test_autoload.py
Original file line number Diff line number Diff line change
@@ -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()
9 changes: 1 addition & 8 deletions tests/test_xontrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

0 comments on commit c4ac13b

Please sign in to comment.