Skip to content

Commit 22eab9e

Browse files
committed
cleanup and notes
Signed-off-by: Justin Cinkelj <[email protected]>
1 parent e93edb2 commit 22eab9e

File tree

7 files changed

+23
-5
lines changed

7 files changed

+23
-5
lines changed

.ansible-lint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ exclude_paths:
99
- examples/vm_os_upgrade/main.yml
1010
- .github/workflows
1111
- changelogs
12+
- .tox

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ child-pipeline-gitlab-ci.yml
88
# developer instance, including credentials
99
tests/integration/integration_config.yml
1010
tests/integration/inventory
11+
collections
1112

1213
docs/build
1314
docs/source/modules

DEVELOPMENT.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ sanity: ## Run sanity tests
147147
units: ## Run unit tests
148148
```
149149
150+
Tox based testing was added as we want to use linters from ansible-network/github_actions.
151+
Sample commands :
152+
153+
```
154+
tox list
155+
tox -e ansible-sanity
156+
tox -m lint
157+
tox -e flake8-lint,pylint
158+
tox -e black,flake8 # will reformat code
159+
tox -e ansible2.18-py312-with_constraints
160+
```
161+
150162
If you want to run tests with a single python version (e.g. not with whole test matrix), use:
151163
152164
```

plugins/inventory/hypercore.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
import os
141141

142142
import yaml
143+
143144
from ansible.plugins.inventory import BaseInventoryPlugin
144145
from ansible.plugins.inventory import Cacheable
145146
from ansible.plugins.inventory import Constructable

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ src_paths = [
9494
]
9595

9696
#sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "ANSIBLE_CORE", "ANSIBLE_AMAZON_AWS", "ANSIBLE_COMMUNITY_AWS", "LOCALFOLDER"]
97+
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "ANSIBLE_CORE", "LOCALFOLDER"]
9798
#known_third_party = ["botocore", "boto3"]
9899
known_ansible_core = ["ansible"]
99100
#known_ansible_amazon_aws = ["ansible_collections.amazon.aws"]

tests/unit/plugins/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
from unittest.mock import MagicMock
1515

1616
import pytest
17-
from ansible.module_utils import basic
18-
from ansible.module_utils._text import to_bytes
1917
from ansible_collections.scale_computing.hypercore.plugins.module_utils.client import Client
2018
from ansible_collections.scale_computing.hypercore.plugins.module_utils.hypercore_version import HyperCoreVersion
2119
from ansible_collections.scale_computing.hypercore.plugins.module_utils.rest_client import RestClient
2220
from ansible_collections.scale_computing.hypercore.plugins.module_utils.task_tag import TaskTag
2321
from ansible_collections.scale_computing.hypercore.plugins.module_utils.vm import VM
2422

23+
from ansible.module_utils import basic
24+
from ansible.module_utils._text import to_bytes
25+
2526

2627
@pytest.fixture
2728
def client(mocker):

tests/unit/plugins/module_utils/test_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
import sys
1414

1515
import pytest
16+
from ansible_collections.scale_computing.hypercore.plugins.module_utils import client
17+
from ansible_collections.scale_computing.hypercore.plugins.module_utils import errors
18+
from ansible_collections.scale_computing.hypercore.plugins.module_utils.utils import MIN_PYTHON_VERSION
19+
1620
from ansible.module_utils.common.text.converters import to_text
1721
from ansible.module_utils.six.moves.urllib.error import HTTPError
1822
from ansible.module_utils.six.moves.urllib.error import URLError
1923
from ansible.module_utils.six.moves.urllib.parse import parse_qs
2024
from ansible.module_utils.six.moves.urllib.parse import urlparse
21-
from ansible_collections.scale_computing.hypercore.plugins.module_utils import client
22-
from ansible_collections.scale_computing.hypercore.plugins.module_utils import errors
23-
from ansible_collections.scale_computing.hypercore.plugins.module_utils.utils import MIN_PYTHON_VERSION
2425

2526
pytestmark = pytest.mark.skipif(
2627
sys.version_info < MIN_PYTHON_VERSION,

0 commit comments

Comments
 (0)