Skip to content

Commit

Permalink
Merge pull request #872 from webknjaz/maintenance/pytest-over-unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz authored Feb 4, 2022
2 parents 61911e0 + adac1a2 commit ce82b7e
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ profile = "black" # Avoid conflict with black
skip_glob = ["tests/fixtures/common/collections*"] # Skip ansible content due to ansible-test sanity ruleset

[tool.pylint]
[tool.pylint.imports]
preferred-modules = [
# NOTE: The unittest replacements below help keep
# NOTE: the tests pytest ecosystem-oriented.
"unittest:pytest",
"unittest.mock:pytest-mock",
]

[tool.pylint.master]
# tm_tokenize is virtually vendored and shouldn't be linted as such
ignore = "tm_tokenize"
Expand Down
1 change: 1 addition & 0 deletions tests/integration/_cli2runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""test from CLI up to runner
"""
# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_execution_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import shlex

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_execution_environment_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import shlex

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_pass_environment_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import shlex

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_set_environment_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import shlex

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock

import pytest
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/actions/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from typing import NamedTuple
from typing import Optional
from typing import Union

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest.mock import mock_open
from unittest.mock import patch

Expand Down
1 change: 1 addition & 0 deletions tests/unit/configuration_subsystem/test_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
import os

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock
from unittest.mock import patch

Expand Down
1 change: 1 addition & 0 deletions tests/unit/configuration_subsystem/test_invalid_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
import tempfile

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest.mock import patch

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/unit/configuration_subsystem/test_precedence.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import os
import shlex

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock
from unittest.mock import patch

Expand Down
2 changes: 2 additions & 0 deletions tests/unit/configuration_subsystem/test_previous_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os

from copy import deepcopy

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock
from unittest.mock import patch

Expand Down
2 changes: 2 additions & 0 deletions tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from copy import deepcopy
from typing import NamedTuple

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest.mock import patch

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_log_append.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test appending to the log.
"""

# pylint: disable=preferred-module # FIXME: remove once migrated per GH-872
from unittest import mock

from ansible_navigator import cli
Expand Down

0 comments on commit ce82b7e

Please sign in to comment.