Skip to content

Commit

Permalink
Minor test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jun 25, 2024
1 parent fd3ed55 commit 7b3108e
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 32 deletions.
43 changes: 22 additions & 21 deletions .config/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#
# pip-compile --all-extras --no-annotate --output-file=.config/constraints.txt --strip-extras .config/requirements.in pyproject.toml
#
ansi2html==1.9.1
ansi2html==1.9.2
ansible-compat==24.6.1
ansible-core==2.17.0
ansible-lint==24.6.0
ansible-core==2.17.1
ansible-lint==24.6.1
astroid==3.2.2
attrs==23.2.0
babel==2.15.0
Expand All @@ -16,37 +16,38 @@ black==24.4.2
bracex==2.4
build==1.2.1
cachetools==5.3.3
cairocffi==1.7.0
cairocffi==1.7.1
cairosvg==2.7.1
certifi==2024.6.2
cffi==1.16.0
cfgv==3.4.0
chardet==5.2.0
charset-normalizer==3.3.2
check-jsonschema==0.28.5
check-jsonschema==0.28.6
click==8.1.7
click-help-colors==0.9.4
colorama==0.4.6
coverage==7.5.3
coverage==7.5.4
cryptography==42.0.8
csscompressor==0.9.5
cssselect2==0.7.0
defusedxml==0.7.1
dill==0.3.8
distlib==0.3.8
dnspython==2.6.1
docstring-parser-fork==0.0.5
docker==7.1.0
docstring-parser-fork==0.0.8
enrich==1.2.7
exceptiongroup==1.2.1
execnet==2.1.1
filelock==3.15.1
filelock==3.15.4
flake8==7.1.0
ghp-import==2.1.0
griffe==0.45.3
griffe==0.47.0
htmlmin2==0.1.13
identify==2.5.36
idna==3.7
importlib-metadata==7.1.0
importlib-metadata==7.2.1
iniconfig==2.0.0
isort==5.13.2
jinja2==3.1.4
Expand All @@ -55,7 +56,7 @@ jsonschema==4.22.0
jsonschema-specifications==2023.12.1
linkchecker==10.4.0
markdown==3.6
markdown-exec==1.9.1
markdown-exec==1.9.3
markdown-include==0.8.1
markdown-it-py==3.0.0
markupsafe==2.1.5
Expand All @@ -69,13 +70,13 @@ mkdocs-gen-files==0.5.0
mkdocs-get-deps==0.2.0
mkdocs-htmlproofer-plugin==1.2.1
mkdocs-macros-plugin==1.0.5
mkdocs-material==9.5.26
mkdocs-material==9.5.27
mkdocs-material-extensions==1.3.1
mkdocs-minify-plugin==0.8.0
mkdocs-monorepo-plugin==1.1.0
mkdocstrings==0.25.1
mkdocstrings-python==1.10.3
mypy==1.10.0
mkdocstrings-python==1.10.5
mypy==1.10.1
mypy-extensions==1.0.0
nodeenv==1.9.1
packaging==24.1
Expand All @@ -84,19 +85,19 @@ pathspec==0.12.1
pexpect==4.9.0
pillow==10.3.0
pip-tools==7.4.1
pipdeptree==2.22.0
pipdeptree==2.23.0
platformdirs==4.2.2
pluggy==1.5.0
pre-commit==3.7.1
ptyprocess==0.7.0
pycodestyle==2.12.0
pycparser==2.22
pydoclint==0.4.1
pydoclint==0.5.1
pyflakes==3.2.0
pygments==2.18.0
pylint==3.2.3
pymdown-extensions==10.8.1
pyproject-api==1.6.1
pyproject-api==1.7.1
pyproject-hooks==1.1.0
pytest==8.2.2
pytest-mock==3.14.0
Expand All @@ -116,10 +117,10 @@ rich==13.7.1
rpds-py==0.18.1
ruamel-yaml==0.18.6
ruamel-yaml-clib==0.2.8
ruff==0.4.9
ruff==0.4.10
six==1.16.0
soupsieve==2.5
subprocess-tee==0.4.1
subprocess-tee==0.4.2
termcolor==2.4.0
text-unidecode==1.3
tinycss2==1.3.0
Expand All @@ -131,8 +132,8 @@ types-jsonschema==4.22.0.20240610
types-pexpect==4.9.0.20240311
types-pyyaml==6.0.12.20240311
typing-extensions==4.12.2
urllib3==2.2.1
virtualenv==20.26.2
urllib3==2.2.2
virtualenv==20.26.3
watchdog==4.0.1
wcmatch==8.5.2
webencodings==0.5.1
Expand Down
1 change: 1 addition & 0 deletions .config/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ansible-lint >= 6.12.1
black
check-jsonschema
coverage[toml]
docker >= 7.1.0 # testing
filelock >= 3.9.0
flake8
mypy
Expand Down
2 changes: 1 addition & 1 deletion .config/requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ansible-compat >= 24.6.1
ansible-core >= 2.12.10
ansible-core >= 2.15.0
click >= 8.0, < 9
click-help-colors
enrich >= 1.2.7
Expand Down
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ ci:
autoupdate_commit_msg: "chore: pre-commit autoupdate"
autoupdate_schedule: monthly
autofix_commit_msg: "chore: auto fixes from pre-commit.com hooks"
default_language_version:
python: python3.10 # minimal we support officially for consistent results

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -30,7 +32,7 @@ repos:
- id: remove-tabs

- repo: https://github.com/pycontribs/mirrors-prettier
rev: v3.3.1
rev: v3.3.2
hooks:
- id: prettier
always_run: true
Expand All @@ -55,20 +57,20 @@ repos:
- id: tox-ini-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.8
rev: v0.4.10
hooks:
- id: ruff
args:
- --exit-non-zero-on-fix

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.8.2
rev: v8.9.0
hooks:
- id: cspell
name: Spell check with cspell

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.0
hooks:
- id: flake8
name: flake8(pydoclint)
Expand All @@ -94,7 +96,7 @@ repos:
- wcmatch

- repo: https://github.com/pre-commit/mirrors-mypy.git
rev: v1.10.0
rev: v1.10.1
hooks:
- id: mypy
additional_dependencies:
Expand Down Expand Up @@ -129,9 +131,8 @@ repos:
--strip-extras
--output-file=.config/constraints.txt pyproject.toml
files: ^.config\/.*requirements.*$
language_version: "3.10" # minimal we support officially
- repo: https://github.com/ansible/ansible-lint
rev: v24.6.0
rev: v24.6.1
hooks:
- id: ansible-lint
stages: [manual]
2 changes: 1 addition & 1 deletion collections/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
collections:
- name: community.crypto
- name: community.docker
version: ">=3.10.2"
version: ">=3.10.4"
- name: containers.podman
- name: kubernetes.core
11 changes: 11 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ def is_subset(subset, superset): # type: ignore[no-untyped-def] # noqa: ANN001
return subset == superset


@pytest.fixture(autouse=True)
def _no_color(monkeypatch: pytest.MonkeyPatch) -> None:
"""Disable coloring output."""
# Analyzing output with no color is much easier. Tests that need to test for
# color output, should override the value.
monkeypatch.setitem(os.environ, "NO_COLOR", "1")
monkeypatch.delitem(os.environ, "PY_COLORS", raising=False)
monkeypatch.delitem(os.environ, "ANSIBLE_FORCE_COLOR", raising=False)
monkeypatch.delitem(os.environ, "FORCE_COLOR", raising=False)


@pytest.fixture()
def resources_folder_path() -> Path:
"""Return the path to the resources folder.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
collections:
- name: community.docker
version: ">=3.10.2"
version: ">=3.10.4"
3 changes: 2 additions & 1 deletion tests/integration/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,5 @@ def test_smoke(monkeypatch: pytest.MonkeyPatch, test_fixture_dir: Path) -> None:
"""
monkeypatch.chdir(test_fixture_dir)
command = ["molecule", "test", "--scenario-name", "smoke"]
assert run_command(command).returncode == 0
result = run_command(command)
assert result.returncode == 0, result
1 change: 1 addition & 0 deletions tests/unit/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def test_markup_detection_pycolors0(monkeypatch): # type: ignore[no-untyped-def


def test_markup_detection_pycolors1(monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
monkeypatch.delenv("NO_COLOR", raising=False)
monkeypatch.setenv("PY_COLORS", "1")
assert should_do_markup()

Expand Down

0 comments on commit 7b3108e

Please sign in to comment.