Commit Graph

31 Commits

Author SHA1 Message Date
Matt Clay
9ee667030f ansible-test - Update sanity test requirements (#85980) 2025-10-13 12:32:39 -07:00
Matt Davis
ff6998f2b9 Switch to stackwalk caller ID (#85095)
* See changelog fragment for most changes.
* Defer early config warnings until display is functioning, eliminating related fallback display logic.
* Added more type annotations and docstrings.
* ansible-test - pylint sanity for deprecations improved.
* Refactored inline legacy resolutions in PluginLoader.

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-05 18:00:02 -07:00
Matt Clay
5ff8d093f0 ansible-test - Code style cleanup (#84749)
* ansible-test - Minor style cleanup (add blank lines)

* ansible-test - Use `"""` instead of `'''`
2025-02-25 04:47:45 +00:00
Matt Clay
83671ecb39 ansible-test - Enable pylint docstyle for tests (#84092)
This cleans up the implementation of the pylint sanity test and enables the docstyle extension rule `bad-docstring-quotes` for tests.

The rule will be enabled for the rest of ansible-core once automated cleanup has been performed on existing docstrings.
2024-10-09 15:38:32 +00:00
Matt Clay
7693c892fa ansible-test - Use Python version in pylint contexts (#83984) 2024-09-23 13:40:10 -07:00
Abhijeet Kasurde
d8f791d88c Bump sanity test requirements for 3.12 (#81846) 2023-10-03 06:38:49 -07:00
Matt Clay
3794612832 ansible-test - Skip pylint test on Python 3.12 (#81706) 2023-09-21 21:01:58 -07:00
Matt Martz
6fead15334 Pylint deprecated comment checker (#81071)
Co-authored-by: Matt Clay <matt@mystile.com>
2023-06-15 16:14:52 -05:00
Matt Clay
fd341265d0 ansible-test - Avoid use of deprecated utcnow (#80750)
The timestamps are only used by ansible-test, not the junit callback, so this change only impacts ansible-test.
2023-05-10 11:26:49 -07:00
Matt Clay
367d45facd ansible-test - Fix error with missing pylint home (#80155) 2023-03-06 19:49:21 -08:00
Matt Clay
27287b40c0 ansible-test - Fix pylint error with old home dir (#80151) 2023-03-06 17:58:14 -08:00
Matt Clay
715ab99462 ansible-test - Improve code formatting (#79983)
* ansible-test - Add blank lines after docstrings

* ansible-test - Preserve formatting of arg pairs

* ansible-test - Remove unused string

* ansible-test - Remove pointless dict() usage

* ansible-test - Clean up initial func arg indenting

* ansible-test - Clean up constructor arg indenting

* ansible-test - Clean up func arg wrapping

* ansible-test - Clean up comma and paren placement
2023-02-13 10:49:58 -08:00
Matt Clay
58d84933fc ansible-test - Clean up indentation and spaces (#79980) 2023-02-10 14:53:36 -08:00
Matt Clay
c9f20aedc0 ansible-test - Fix various type hinting issues. (#79798)
* ansible-test - Add missing type hints.

* ansible-test - Remove redundant type hints.

* ansible-test - Fix return type annotations.

* ansible-test - Add assert, casts to assist mypy.

* ansible-test - Fix incorrect type hints.

* ansible-test - Remove no-op code.

* ansible-test - Fix incorrect types.

* ansible-test - Fix method signature mismatch.
2023-01-23 16:56:07 -08:00
Matt Clay
bc274f57f7 ansible-test - Improve pylint command consistency. (#78896)
* ansible-test - Improve pylint command consistency.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2022-09-27 11:39:25 -07:00
Matt Clay
c56b35598f ansible-test - Upgrade pylint. (#78727)
This version of pylint now supports Python 3.11.
2022-09-07 14:22:38 -07:00
Matt Clay
85acf4d1e5 ansible-test - Avoid use of deprecated type hints. (#78456)
* ansible-test - Avoid use of deprecated type hints.

PEP 585 deprecated many container types in the `typing` module in favor of the actual types, which support subscripting as of Python 3.9.

Conversion of `t.Type` was skipped since PyCharm does not currently recognize it.

* ansible-test - Fix `t` and `c` imports/shadowing.
2022-08-04 22:29:38 -07:00
Matt Clay
5bee66fc5d ansible-test - More type hint updates. (#78455)
* Simple regex replace of multi-line function arg annotations on the first line.

* Manually fix up ArgumentParser type annotations.

* Manual type hint conversions.

* Manual conversion of function type hints.

* Remove unnecessary type hints on for statements.
2022-08-04 15:51:11 -07:00
Matt Clay
b993b5cd49 ansible-test - Convert more type hints. (#78449)
* Simple regex replace of multi-line function arg annotations.

* Simple regex replace of multi-line function arg annotations with default values.

* Simple regex replace of multi-line function arg return annotations.

* Simple regex replace of assignment annotations.
2022-08-04 12:15:46 -07:00
Matt Clay
3eb0485dd9 ansible-test - Use more native type hints. (#78435)
* ansible-test - Use more native type hints.

Simple search and replace to switch from comments to native type hints for return types of functions with no arguments.

* ansible-test - Use more native type hints.

Conversion of simple single-line function annotation type comments to native type hints.

* ansible-test - Use more native type hints.

Conversion of single-line function annotation type comments with default values to native type hints.

* ansible-test - Use more native type hints.

Manual conversion of type annotation comments for functions which have pylint directives.
2022-08-03 15:08:55 -07:00
Matt Clay
86779cc903 ansible-test - Code cleanup.
This helps prepare for a future pylint upgrade.
2022-06-01 11:45:41 -07:00
Matt Clay
dfde4be444 Add Python 3.11 support.
ci_complete
ci_coverage
2022-05-17 23:52:47 -07:00
Matt Clay
5c2d830dea ansible-test - Fix subprocess management. (#77641)
* Run code-smell sanity tests in UTF-8 Mode.
* Update subprocess use in sanity test programs.
* Use raw_command instead of run_command with always=True set.
* Add more capture=True usage.
* Don't expose stdin to subprocesses.
* Capture more output. Warn on retry.
* Add more captures.
* Capture coverage cli output.
* Capture windows and network host checks.
* Be explicit about interactive usage.
* Use a shell for non-captured, non-interactive subprocesses.
* Add integration test to assert no TTY.
* Add unit test to assert no TTY.
* Require blocking stdin/stdout/stderr.
* Use subprocess.run in ansible-core sanity tests.
* Remove unused arg.
* Be explicit with subprocess.run check=False.
* Add changelog.
* Use a Python subprocess instead of a shell.
* Use InternalError instead of Exception.
* Require capture argument.
* Check for invalid raw_command arguments.
* Removed pointless communicate=True usage.
* Relocate stdout w/o capture check.
* Use threads instead of a subprocess for IO.
2022-04-27 14:07:15 -07:00
Matt Clay
26fd5a8c3a Revert "ansible-test - Fix subprocess management. (#77638)"
This reverts commit 62d03c8e75.
2022-04-25 15:38:35 -07:00
Matt Clay
62d03c8e75 ansible-test - Fix subprocess management. (#77638)
* Run code-smell sanity tests in UTF-8 Mode.
* Update subprocess use in sanity test programs.
* Use raw_command instead of run_command with always=True set.
* Add more capture=True usage.
* Don't expose stdin to subprocesses.
* Capture more output. Warn on retry.
* Add more captures.
* Capture coverage cli output.
* Capture windows and network host checks.
* Be explicit about interactive usage.
* Use a shell for non-captured, non-interactive subprocesses.
* Add integration test to assert no TTY.
* Add unit test to assert no TTY.
* Require blocking stdin/stdout/stderr.
* Use subprocess.run in ansible-core sanity tests.
* Remove unused arg.
* Be explicit with subprocess.run check=False.
* Add changelog.
2022-04-25 12:39:09 -07:00
Sloane Hertel
b50f16db91 Update collection loader for Python 3.10 (#76225)
* Implement find_spec and exec_module to remove reliance on deprecated methods in the collection loader

ci_complete

* Move module execution to exec_module

Remove extra sys.modules handling

Use default module initialization by returning None from loader.create_module

Refactor

ci_complete

* Remove ansible-test's copy of the collection loader

ci_complete

* Fix metaclass for Python 2.x

ci_complete

* Fix Py2/Py3 syntax compatibility

* Refactor

ci_complete

* update collection_loader comments

ci_complete

* simplify find_module

ci_complete

* Fix Py2 compatibility - don't get loader from nonexistent spec

Remove unnecessary PY3 checking

* Refactor common code in load_module and exec_module

ci_complete

* tidy diff

ci_complete

* Include collection_loader in target paths for 'compile' sanity test

* add changelog

* Add "return None" instead of doing it implicitly

Remove get_filename

short-circuit exec_module if it's a redirect

ci_complete
2021-12-01 09:47:10 -08:00
Matt Clay
58b03be417 ansible-test - Code cleanup. (#75774)
* ansible-test - Remove unused code.
* ansible-test - More PEP 484 type hints.
2021-09-24 00:38:56 -07:00
Matt Clay
4ea8d9a782 ansible-test - split controller/target testing (#75605) 2021-09-20 18:39:07 -07:00
Matt Clay
99a79e1969 ansible-test - Move code from _data to _util. (#75495)
* Update paths to match relocated files.
* Update ansible-test symlink paths.
* Update path classification.
* Update MANIFEST.in
* Update sanity test context paths.
* Update sanity ignores.
* Update shebang sanity test.
* Update configure-remoting-ps1 sanity test.
* Update BOTMETA.yml to reflect new paths.
* Update paths in collection loader comments.
* Update Makefile for ansible-test.
* Update docs.
* Add changelog fragment.
2021-08-12 15:07:06 -07:00
Matt Clay
df2ae06d46 Fix ansible-test imports and paths after refactor.
Also include a changelog entry covering this commit and the previous.
2021-05-05 16:20:15 -07:00
Matt Clay
bb3904d299 Reorganize command implementations.
This commit only renames existing files.

Changes to adapt imports will occur in a follow-up commit.
2021-05-05 16:20:15 -07:00