Commit graph

37 commits

Author SHA1 Message Date
Matt Clay
ecc706f122 Fix ansible-test unit test execution. (#45772)
* Fix ansible-test units requirements install.
* Run unit tests as unprivileged user under Docker.

(cherry picked from commit 379a7f4f5a)
2018-10-09 18:25:24 -07:00
Matt Clay
7abdab6c9e Convert ansible-test compile into a sanity test. 2018-01-25 09:45:36 -08:00
Ryan S. Brown
ae5c370737 Fail hard when tests pass that are expected to fail
`@pytest.mark.xfail()` can be used to decorate tests that don't yet
pass. By default, if I wrote a test like this:

```
@pytest.mark.xfail()
def test_naughty():
    assert 1 == 1
```

Then Pytest would allow this test to pass without notifying that an
expected-fail *didn't* fail. To make that happen, you have to set
xfail_strict=True so that the above test would cause the tests to fail.
2017-12-21 10:27:38 -08:00
Matt Clay
7ab4a889ad Update tox.ini to use ansible-test. 2017-06-30 16:41:30 -07:00
Adrian Likins
a936ea1333 update the flake8 config in tox.ini 2017-04-05 09:43:37 -07:00
Tadej Janež
1bdffbd7ea Pass TEST_FLAGS environment variable to tests run with Tox (#21611)
This allows customizing test runs when using Tox.
2017-02-20 15:24:39 -08:00
Will Thames
ed52714dba Update tox.ini to match current standards
tox.ini is used for flake8 configuration in addition to tox
configuration. Update the flake8 configuration to match the
latest standards as documented in ansible/proposals#50
2017-02-02 21:05:39 -08:00
Lucas Alvares Gomes
e8a94acffa Pass the HOME environment variable to testenv in tox.ini
In order to avoid the "missing HOME variable" issue when running the
unit tests, this patch is passing the HOME environment variable to
[testenv].

Fixes #20424
2017-01-19 12:06:16 -08:00
Marius Gedminas
74f07c66be Fix envlist in tox.ini
tox doesn't actually expand {brace,expressions} in envlist, so if you ran `tox` without specifying a `-e` parameter, tox would try to run `py26`, `py27`, `py3{5` and `6)`, defaulting to python2.7 for those non-standard environment names.
2017-01-09 10:13:09 -05:00
Andrii Soldatenko
5afad65895 Added py36 to tox.ini 2017-01-06 10:05:39 -08:00
Toshio Kuratomi
b8a8027b7d We've decided that python-3.5 is the minimum python version (#17270) 2016-08-29 09:12:37 -07:00
Michael Scherer
42d8ababcb Start to test module_utils for python 3 syntax (#15882) 2016-05-17 10:50:28 -07:00
Toshio Kuratomi
18587842c6 Exclude the sample directory from tests 2016-05-11 12:03:23 -07:00
James Cammarata
286d91d722 Reorganizing tox stuff and making py3-specific requirements 2016-03-11 11:25:28 -05:00
Toshio Kuratomi
ab44cf2a9a Start a pyflakes section to cut down on extra messages that we don't agree are problems 2015-11-11 07:50:19 -08:00
Toshio Kuratomi
63add130d4 Tox seems to not like the subsitution key for some reason 2015-10-19 11:04:30 -07:00
Marius Gedminas
43fe74f0fe Simplify tox.ini, remove outdated comment 2015-10-19 09:43:27 +03:00
Marius Gedminas
bd83410bdb Enable unit tests on Python 3.4 in tox and Travis
These now pass \o/
2015-10-16 17:19:26 +03:00
Marius Gedminas
a412b27604 Enable unit tests on Python 3.5
This enables the tests in tox and in Travis.  This ought to prevent
regressions in Python 3 support.

Note that Python 3.4 isn't supported (yet) because the vault code relies on
%-formatting of byte strings, a feature that was ripped out of Python 3.0
and restored in 3.5.

Also note that passing tests don't mean that Ansible itself can already
be used with Python 3.5: test coverage is only 53%.
2015-10-16 09:14:36 +03:00
Marius Gedminas
f1f3bc9e50 Add Python 3.5 to tox.ini 2015-10-04 10:59:19 +03:00
Marius Gedminas
e9b114a39b Simplify tox.ini
Use the factor-conditional settings feature of tox >= 1.8 to reduce
duplication:
https://tox.readthedocs.org/en/latest/config.html#factors-and-factor-conditional-settings
2015-10-04 10:57:49 +03:00
Marius Gedminas
3e0330ad3b Remove redundancies from tox.ini 2015-10-04 10:51:37 +03:00
Marius Gedminas
3f9879aedb Use print() as function under contrib/
This fixes the remaining Python 3 syntax errors, so re-enable compileall
for contrib/ again.
2015-08-28 09:18:13 +03:00
Toshio Kuratomi
1eee5ec6ff Enable py34 test in travis so we don't regress recent fixes 2015-08-27 13:20:52 -07:00
Marius Gedminas
9e82ecaf91 Disable compileall test for contrib/ in tox -e py34
(This is supposed to be temporary, until the code under contrib/ gets
cleaned up from all the remaining print statements.)
2015-08-27 22:15:57 +03:00
Marius Gedminas
0c6ce31f76 Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
2015-08-27 22:15:04 +03:00
Toshio Kuratomi
3f099ca0a2 Better way to stop tox running on unwanted directories 2015-08-27 10:41:46 -07:00
Marius Gedminas
b44eae9ebc Don't compile .py files under .tox/
'tox -e py26' would fail for me because python -m compileall would crawl
under .tox/py27 and, unsurprisingly, get SyntaxErrors on files from the
Python 2.7 standard library using syntax features not supported by
Python 2.6.
2015-08-26 08:31:43 +03:00
Toshio Kuratomi
87cb7f8147 Push python2.4 check into travis 2015-07-31 23:45:10 -07:00
James Cammarata
13b8a57d3d Undo previous travis/tox fixes and fix underlying issue 2015-07-31 23:01:43 -04:00
James Cammarata
7c332b63dc Updating tox script too 2015-07-31 22:55:59 -04:00
Brian Coca
29a9b8ab7d dont check vagrant inventory script for 2.6 2015-07-21 13:44:45 -04:00
Toshio Kuratomi
176b04a812 Correct typo 2015-06-11 09:03:20 -07:00
Matt Martz
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
Toshio Kuratomi
0da7834584 Move command for v1 back into testenv so that we have a default
(We have a jenkins build that creates a [testenv:jenkins] so it needs
there to be a default value
2015-04-14 15:46:25 -07:00
Rory Finnegan
131ce117a9 Updated the tox.ini file to run multiple ansible versions.
Purpose: so that devs can use tox to run v1 or v2 of ansible with various versions of python.
For example `tox -e py27-v2 will run python2.7 on v2. Currently, only py26 and py27 are run on v1 when
running just `tox` so that we aren't breaking builds.
2015-04-14 16:30:52 -04:00
James Laska
3d67e9e0c0 Add tox and travis-ci support
Add tox integration to run unittests in supported python releases.
Travis-CI is used for test execution.

Additionally, the unittest TestQuotePgIdentifier was updated to support
using assert_raises_regexp on python-2.6.

Sample travis-ci output available at
https://travis-ci.org/ansible/ansible/builds/54189977
2015-03-13 08:20:24 -04:00