Commit Graph

37 Commits

Author SHA1 Message Date
Matt Clay
dc5209a3fd
ansible-test - Replace TypeVar usage (#85603) 2025-07-30 19:04:47 -07:00
Matt Clay
7ef13cb29e
ansible-test - Add remote debugging support (#85317) 2025-06-12 18:57:36 +00: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
4b38456e4f
ansible-test - Correct CLI arg type and annotation (#84664) 2025-02-04 17:53:14 +00:00
Jordan Borean
f9b58fa13f
ansible-test - fix coverage for test modules (#84366)
Fixes the coverage path translation for modules located in integration
test paths. Instead of trying to match by the unique temporary path name
that the module is executed as, the reporting tool will translate it to
the static path that the module is actually located under.
2024-11-27 13:43:06 +10:00
Matt Clay
5a059b81c8
ansible-test - Fix Python coverage stub generation (#81611)
As of coverage 7.1.0, files without arcs are not generated.

To work around this, an empty (0, 0) arc is used for each file instead.

This is a follow-up to https://github.com/ansible/ansible/pull/81077

ci_coverage
ci_complete
2023-08-31 10:53:10 -07:00
Matt Clay
3a1d58bc58
ansible-test - Use raise from to handle exceptions (#80905) 2023-05-26 20:25:17 -07: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
c8c1402ff6
ansible-test - Fix file permissions for delegation (#79932)
* ansible-test - Fix file permissions for delegation

* Set more restrictive permissions for SSH key

* Check all execute bits, not just owner

* Add a breaking_changes changelog entry
2023-02-07 12:18:20 -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
f9715f436c ansible-test - Avoid direct use of errno.
Error handling on Python 3.x no longer requires the use of `errno` to identify specific errors.
2022-11-29 13:40:04 -08: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
a3c90dd0bc
ansible-test - Fix TTY and output handling. (#78350) 2022-07-26 11:43:48 -07:00
Matt Clay
2f0530396b ansible-test - Clean up type hints and comments. 2022-06-08 23:31:58 -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
fe349a1ccd
ansible-test - Enhance the shell command. (#77734)
* ansible-test - Add shell --export option.

* ansible-test - Support cmd args for shell command.

Also allow shell to be used without a valid layout if no delegation is required.

* ansible-test - Improve stderr/stdout consistency.

By default all output goes to stdout only, with the exception of a fatal error.

When using any of the following, all output defaults to stderr instead:

* sanity with the `--lint` option -- sanity messages to stdout
* coverage analyze -- output to stdout if the output file is `/dev/stdout`
* shell -- shell output to stdout

This fixes issues two main issues:

* Unpredictable output order when using both info and error/warning messages.
* Mixing of lint/command/shell output with bootstrapping messages on stdout.

* ansible-test - Add changelog fragment.
2022-05-05 09:09:57 -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
Matt Clay
b960641759 ansible-test - Support multiple coverage versions.
ci_complete
ci_coverage
2022-04-19 23:15:38 -07:00
Matt Clay
0c514bcf54 ansible-test - Fix PS coverage --all generation. 2022-03-09 12:35:23 -08:00
Matt Clay
af2b1361ff ansible-test - Simplify type hints. 2022-03-03 16:34:25 -08:00
Matt Clay
a06fa496d3
ansible-test - Code cleanup and refactoring. (#77169)
* Remove unnecessary PyCharm ignores.
* Ignore intentional undefined attribute usage.
* Add missing type hints. Fix existing type hints.
* Fix docstrings and comments.
* Use function to register completion handler.
* Pass strings to display functions.
* Fix CompositeAction handling of dest argument.
* Use consistent types in expressions/assignments.
* Use custom function to keep linters happy.
* Add missing raise for custom exception.
* Clean up key/value type handling in cloud plugins.
* Use dataclass instead of dict for results.
* Add custom type_guard function to check lists.
* Ignore return type that can't be checked (yet).
* Avoid changing types on local variables.
2022-02-28 14:37:09 -08:00
Matt Clay
d2daa67b00 ansible-test - Fix type hints. 2022-01-05 10:04:06 -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
6c133da45e
ansible-test - Fix code coverage reporting. (#75771) 2021-09-23 21:24:01 -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
787f722d94 Fix combined coverage file detection.
Resolves an issue introduced with https://github.com/ansible/ansible/pull/74719
2021-05-17 16:26:14 -07:00
Matt Clay
ce04056797 Expand delegation options for coverage commands. 2021-05-17 10:37:42 -07:00
Jordan Borean
e875e91363
ansible-test - use pwsh to generate stubs (#74271) 2021-05-17 10:00: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