Commit Graph

24 Commits

Author SHA1 Message Date
Vsevolod Fedorov f4d64f9f66 Move tests to pytest
Pytest makes each scenario into individual selectable test.
To be able to run each scenario separately is very useful for development.

Change-Id: I4b1c990a1fd839ce327cd7faa27159a9b9632fed
2022-12-20 10:44:43 +03:00
Eric Ball 930dd24dd2
Fix: Update sphinx version pin, fix warnings
Sphinx was pinned to >1.5.0 <=1.7.0 4 years ago. It is now on v4.4.0,
and we're seeing an incompatibility with the latest version of jinja2.

Along with updating the Sphinx version, this also includes fixes for
several warnings generated in the latest version:
  * Outdated docs due to the removal of the "parser" param from
    Base.get_xml
  * Class lookup issues
  * External links for which we have extlinks defined
  * Deprated PyModulelevel is replaced by PyFunction
  * sphinx.ext.autodoc.Documenter.get_doc signature changed

Signed-off-by: Eric Ball <eball@linuxfoundation.org>
Change-Id: Iba65fb724f098f3e4a0b20f2a183cb2ea3c450ea
2022-03-31 15:44:40 -07:00
Adam Romanek 1590466de9 Fix CI for Python 2
Black dropped Python 2 support in 22.1.0. Unfortunately we can't pin
the version as <22.1.0 becasue in the past Black was versioned using
just main.major, not main.major.minor, and they were only releasing beta
versions, hence the 'b' suffix.

Pluggy 1.0.0 dropped Python 2 support.

It seams JJB should drop support for Python 2 too. Otherwise it will
be harder and harder to maintain dependencies...

Change-Id: I13b82a02bb50ab46183ff04aae521b44e475f743
2022-02-11 13:03:56 +01:00
Adam Romanek 118ac858c4 tests: fix mixed imports of 'unittest.mock' and 'mock'
The 'mock' package is imported in 'tests.base'. Whenever possible
'tests.base' prefers 'unittest.mock' over 'mock' (which is the case on
Python 3.3+). Importing 'mock' together with 'unittest.mock' causes
unexpected behavior that results in exceptions when running tests, at
least on Python 3.6.12, like:

>  File "/usr/lib/python3.6/unittest/mock.py", line 1196, in patched
>    patching.__exit__(*exc_info)
>
>  File "/home/zuul/src/opendev.org/jjb/jenkins-job-builder/.tox/cover/lib/python3.6/site-packages/mock/mock.py", line 1545, in __exit__
>    return exit_stack.__exit__(*exc_info)
>
>  File "/usr/lib/python3.6/contextlib.py", line 339, in __exit__
>    received_exc = exc_details[0] is not None
>
>  IndexError: tuple index out of range

From now on, to avoid similar issues in the future, the 'mock' package
is only installed for Python 2.x.

Change-Id: Ib3044312f0770735d88d8657d1f953e5a33e771f
2021-01-01 12:58:28 +01:00
Antoine Musso ff7101b019 Blacklist stestr 3.0.0
stestr 3.0.0 does not support python 2.7 but has been released without
the proper metadata to reflect that. As a result, there is a python2 wheel
stestr-3.0.0-py2-none-any.whl which get picked up.

Blacklist stestr 3.0.0 to fix '--list': no such option error

Change-Id: I11898e1021973fa4c3031f1388d58d868feb601a
2020-04-17 14:30:32 +02:00
Sorin Sbarnea 7754995474 Correct dependencies on tox linters
Linters only requirement is pre-commit, as the tools takes care of the rest.
This speeds up linting and lowers disk footprint by removing unnecessary deps.

Change-Id: I82b974a5257671bc2e8e987d0f556ddae345feea
2019-07-13 15:19:54 +01:00
Sorin Sbarnea 539d13e816 Fix flake8 failures and make its execution more consistent
- upgrade flake8 to 3.6.0
- remove use of hacking since pre-commit replaced it
- mentioned minimal flake8 version on pre-commit config
- fixed newer linting errors
- disable W504 as it seems not possible to fix (conflict with W403)
- replaced buggy tox deps installation with native pip install, which
  address the issue of missing to install new deps when the reqs files
  are updated, developer being forced to to recreate the virtualenv.
- prepare for migration from tox-pep8 to tox-linters, now these being
  just aliases.

Change-Id: I310578dce215aaf00a5b2d54716f90da9a1ecb4d
Depends-On: https://review.openstack.org/#/c/613726/
2018-10-28 11:44:43 +00:00
Sorin Sbarnea 4953756c27
adopt pre-commit hooks
Change-Id: I98bc0b5717c3921b35e74f53c55f896427880a84
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2018-07-12 13:40:38 +01:00
Sorin Sbarnea 4f7b6ee568
upgrade hacking module
- upgrades hacking to current version
- sorts new linting issues
- sorts bug with sys.reload on py3

Change-Id: I4a18abc93116667a2733e8aec619ac59ea73d630
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2018-06-19 18:04:37 +01:00
Sorin Sbarnea c8ba7a5a0f Replace testr with stestr
Switch to use stestr which is maintained as opposed
to testrepository (testr) which became a defunct project.

Change-Id: I47f628a7d224189362f2b2cfd9fe4c54af198cde
2018-04-05 12:14:13 +01:00
Wayne Warren 28d02cddc3 Add tox to test-requirements.txt
If I understand correctly, tox is already installed on automated test
nodes; however, the intent here is to improve local development workflow
by ensuring that an appropriate version is installed for running tests
locally.

This requires at least tox 2.9.1, which is the version that was used in
a zuul run observed today.

Change-Id: I8052e5792e229b58a48e48bd705ed576acdc2884
2018-02-23 14:02:34 -05:00
Sorin Sbarnea d8ace6802d docs: sphinx upgrade and warnings as erros
Change-Id: I455ac0d79cca3883d3a758a2709c8c0255f4cc7d
2018-01-26 23:57:53 +00:00
Monty Taylor 503fd8dcd4
Sync requirements with openstack/requirements
This is not necessary - jenkins-job-builder does not follow the
requirements sync process. That said - these are likely all safe bets
for being solid versions of these dependencies - and some of them were
kinda stale.

Change-Id: Id1941ff4c9736100f9bdd5508ec3c0377e51fdbe
2016-12-10 09:42:57 -06:00
Monty Taylor dd8ba49a7c
Fix docs build issue
For some reason docs builds break when using the sphinx version listed.
Just use the same one as the rest of OpenStack.

Also - while we're at it - setuptools_git hasn't been a thing in a LONG
time.

Change-Id: I70d45f5b237ceb9b67ca4ce458816f41a197d228
2016-12-10 09:42:18 -06:00
Swapnil Kulkarni (coolsvap) b5634f88c3 Remove discover from test-requirements
It's only needed for python < 2.7 which is not supported

Change-Id: I0481ddae841b46d517ea435f05960de6d99ccc09
2016-07-22 04:56:46 +00:00
Khai Do 6a68da8e03 Update sphinx to be compatible with readthedocs.org
JJB docs are published to readthedocs.org but fails to build because
RTD only supports a newer version of sphinx.  Updating sphinx to
version 1.3.1 so build won't fail on RTD.

depends-on: Iba92628263e20efca84aeada0e19000f4c9b1fac
Change-Id: Ia8d4033bf2def5066bda26813b41338408093481
2015-09-28 20:46:42 +00:00
Darragh Bailey 0c012a93c4 Support hacking module <= 0.10.1
Update version restrictions to allow hacking module <= 0.10.1 and fix
any style errors reported by the latest version.

Change-Id: Ia608096342b11e411e56a86e8f289f9891077895
2015-03-03 01:10:26 +00:00
Darragh Bailey 2d74b16620 Move ordereddict to requirements
Need ordereddict in the requirements as it is used at run time by the
yaml parsing code not just a test time.

Change-Id: Ic41e7adb5a06ed319f6201a13b9f7391fc245853
2014-09-04 14:58:20 +01:00
Darragh Bailey c99cbccb8e Ensure dict orders are deterministic
Python 3 enables hash randomization by default, additionally tox 1.7
turns on the same randomization for earlier versions of python by
default. Need to ensure that order of iteration over the yaml data and
resulting XML has deterministic order for testing.

Adapts https://gist.github.com/enaeseth/844388 which ensures data read
by yaml will have its order retained in a predictable manner across
multiple python versions.

Additionally it seems more sensible to ensure that the order of
generated XML snippets corresponding to the input yaml files are
consistently in the same order as the entries in the source files.

Closes-Bug: #1333349
Change-Id: I6bf6d298a2609cc6ddbbc6b02b7f1a04413a5c89
2014-09-01 14:15:10 +01:00
Darragh Bailey fd82f48a84 Argparse is required for JJB to parse arguments
Move argparse requirement from tests to install requirements as it is
required when using JJB.

Change-Id: If503ebfe790c904f77ef45b59ea909a2577db5cd
2014-07-27 00:49:51 +01:00
Khai Do 1df929c58a tests for JJB command processing
Add a few tests for JJB command processing.  This is just to get
started I'm hoping more will come.

Change-Id: Iff964af025f6a3d7ba4acd91b1e0242285a11bc3
2014-07-09 08:55:10 -07:00
Marc Abramowitz b33ac74828 Add tox "coverage" target
Change-Id: I577d62e016a550ea30671837a0a426165984e982
2014-05-27 16:50:34 -07:00
James E. Blair 6067cc712c Add hacking to requirements
Solely for the transitive dependencies.  Ignore errors from hacking
as do the other openstack-infra python projects.

Change-Id: Ib5953c31a5380f9f57c7f79e1ce0699aef5eb629
2014-04-16 10:37:12 -07:00
Antoine Musso d2ff8c098f Migrate to pbr
I found out pbr to be a bit nicer when it comes to edit files. AFAIK
most OpenStack project are using it, so I guess Jenkins Job Builder can
be pbr based as well.o

Basically:
* moved everything from setup.py to setup.cfg
* sorted entries while at it
* require pbr module using the same version limits used by Zuul
* enable pbr.warnerrors
* testenv.usedevelop = True or build_sphinx can not find entry points
* move requirement files to root of repository (we had them in /tools/)

Change-Id: I44ee8910ad4fe4eebb7337951efa31baff4281fe
2014-03-14 22:25:46 +01:00