Commit Graph

34 Commits

Author SHA1 Message Date
7e3916b767 Typo fixes and other bits and bobs (#83672)
Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
2024-07-27 09:16:34 -07:00
18e8401edd Remove Python 2.x compat from unit tests (#82109) 2023-11-01 16:37:08 -07:00
9f899f9492 Require from __future__ import annotations (#81902) 2023-10-04 22:11:17 +00:00
652ddc4078 Fix pylint disallowed-name errors (#80854)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2023-05-22 11:11:36 -07:00
8db9bd7574 Remove deprecated include (#80752)
* Remove deprecated include

* Add tombstone entry for include

* Use string for date

* Use todays date

* Remove uneeded if statement
2023-05-19 05:49:07 +10:00
c33c8cf086 Remove unused and unreachable unit test code (#79854) 2023-01-30 15:29:17 -08:00
56d142350d Add support for importlib.resources (#78915)
* Add support for importlib.resources

* Remove the importlib.resources imports

* return the correct data

* Some code comments, and re-order for consistency

* Disallow traversing packages below an individual collection

* Add a traversable class for namespaces

* Re-use variable

* Utilize itertools.chain.from_iterable

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Simplify logic to check for packages from ansible loaders

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Just a generator expression, instead of a generator

* docstrings

* Add comment about find_spec for our namespaces

* Add some initial unit tests for importlib.resources

* normalize

* Utilize importlib.resources for listing collections

* collections_path is already in config, just use config

* install uses a different default for collections_path

* Remove unused import

* Remove duplicate __truediv__

* Bring back TraversableResources

* Apply some small suggestions from code review

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>

* Remove cross contamination between plugin loader code and CLI code

* Remove unused import

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2023-01-10 11:09:57 -06:00
9ee183c4b9 Clean up unit tests. (#78498) 2022-08-10 14:41:52 -07:00
3a9a23fb1a Use unittest.mock instead of mock. (#77883)
This can only be done for controller tests.
2022-05-23 11:04:56 -07:00
94eff70030 PlayIterator - remove deprecated states (#77444) 2022-04-11 15:13:10 +02:00
1a5853d794 Remove obsolete units.compat.mock compat layer. (#77118)
* Remove obsolete units.compat.mock compat layer.
* Update remaining units.compat.mock references.
2022-02-22 18:20:11 -08:00
5c225dc0f5 Introduce public methods to access PlayIterator._host_states (#74416) 2021-11-09 08:07:51 +01:00
395e5e20fa PlayIterator: use enums for states (#74511) 2021-10-26 10:16:17 +02:00
1b70260d5a Add implicit role_complete block instead of role._eor (#72208)
Co-authored-by: Matt Martz <matt@sivel.net>

Fixes #69848
2020-12-09 09:53:01 +01:00
c67efe0bd1 Avoid unnecessary comprehensions. 2020-06-18 11:50:31 -07:00
c5d61953b1 Remove empty setUp/tearDown/tearDownClass methods in test classes. 2019-11-06 08:14:29 -08:00
4e8df9a4b8 unit tests: remove unused imports (#59636) 2019-07-26 10:53:31 -04:00
3033fd96b0 Move unit test compat code out of lib/ansible/. (#46996)
* Move ansible.compat.tests to test/units/compat/.
* Fix unit test references to ansible.compat.tests.
* Move builtins compat to separate file.
* Fix classification of test/units/compat/ dir.
2018-10-12 20:01:14 -07:00
b107e397cb Cache tasks as they are queued instead of en masse (#34752)
* Cache tasks as they are queued instead of en masse

This also moves the task caching from the PlayIterator to the
StrategyBase class, where it makes more sense (and makes it easier
to not have to change the strategy class methods leading to an API
change).

Fixes #31673

* Cleaning up unit tests due to 502ca780
2018-01-15 09:49:58 -06:00
4efec414e7 test/: PEP8 compliancy (#24803)
* test/: PEP8 compliancy

- Make PEP8 compliant

* Python3 chokes on casting int to bytes (#24952)

But if we tell the formatter that the var is a number, it works
2017-05-30 18:05:19 +01:00
9d549c3498 Fixing iterator bug related to reworking of end-of-role detection
Bug was introduced in cae682607
2017-01-19 10:10:07 -06:00
cae682607c Reworking the way end of role detection is done
Rather than trying to enumerate tasks or track an ever changing cur_role
flag in PlayIterator, this change simply sets a flag on the last block in
the list of blocks returned by Role.compile(). The PlayIterator then checks
for that flag when the cur_block number is incremented, and marks the role
as complete if the given host had any tasks run in that role.

Fixes #20224
2017-01-18 17:29:52 -06:00
47acf55fa9 Cache tasks by uuid in PlayIterator for O(1) lookups
Rather than repeatedly searching for tasks by uuid via iterating over
all known blocks, cache the tasks when they are added to the PlayIterator
so the lookup becomes a simple key check in a dict.
2016-08-10 12:49:19 -05:00
06d4f4ad0e Move tasks/blocks to a single parent model 2016-08-08 15:58:46 -05:00
373b23cc24 Fix mock loader for osx /etc symlinks (#16074)
Fix role based unit tests for osx via mock.patch
2016-05-31 18:02:39 -04:00
9d61a6cba8 Fixing PlayIterator bugs
* Unit tests exposed a problem where nested blocks did not correctly
  hit rescue/always portions of parent blocks
* Cleaned up logic in PlayIterator
* Unfortunately fixing the above exposed a potential problem in the
  block integration tests, where a failure in an "always" section may
  always lead to a failed state and the termination of execution
  beyond that point, so certain parts of the block integration test
  were disabled.
2016-03-09 13:31:30 -05:00
299d93f6e9 Updating unit tests for PlayIterator
This knowingly introduces a broken test, planning to fix that later.
2016-03-07 13:03:06 -05:00
dfa33d0f23 Tweak variable manager use in role includes to avoid test failures 2015-09-30 08:05:55 -04:00
b2cb3153f1 Fix unit tests for PlayIterator changes regarding fact gathering 2015-09-03 14:25:43 -04:00
993ce592b1 Update unit tests for flush_handlers fix 2015-07-22 11:30:05 -04:00
e64989beb4 Moving ConnectionInformation -> PlayContext
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
2015-07-21 12:13:50 -04:00
1ca8cb8553 Fixing up v2 unit tests 2015-05-12 12:24:57 -05:00
a0fc8bb0bd Testing additions and fixes
* Fix import pathing for units.mock
* Add some additional requirements
* Use compileall to test compatiblity with different python versions
2015-05-08 13:40:02 -05:00
ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00