Commit Graph

36 Commits

Author SHA1 Message Date
Sorin Sbarnea 0cbc0cd524 Replace testr with pytest
Using a single test run orchestrator makes it easier to maintain
the project, especially as pytest is actively maintained.

Change-Id: I5c843984bc0a1b9264e744373e6a3fd9d43e99cd
2020-09-17 15:49:32 +01:00
Sorin Sbarnea ed5296999e pylint: fixed imports
Fixed pylint violations around imports. Implements
standard import ordering (isort).

Change-Id: Ib89108925487e49109d18ae315cd4892b8b48837
2020-09-10 13:46:38 +01:00
Sorin Sbarnea c6f07d7f93 Use pytest for queries
Switches queries testing to use of pytest which provides the following:
- test generator for each query (parametrize)
- ability to test a single query test
- generate html report with test results, making easier to investigate
  failures.
- parallel executions
- minor bugfix which prevented running queries from running with py38
  as the  config parser requires only strings (None being invalid).

Change-Id: I982c694a5160a9ecfd117d177d30b911cfe53425
2020-09-10 10:24:37 +00:00
Zuul 50cd9d6aa3 Merge "Enable pylint" 2020-09-08 13:02:49 +00:00
Zuul ee0c3ef6dc Merge "Avoid pip breakage due to keyring" 2020-09-08 13:01:46 +00:00
Sorin Sbarnea 01a290f2c0 Enable pylint
- enable pylint execution with current violations temporary disabled
- avoid installing dependencies for linting (heavy)
- pin linters to avoid suprises

Change-Id: Ica47efcec7a4da3b0bf949612cf9f1a49016c488
2020-09-08 12:12:07 +00:00
Sorin Sbarnea baea37e12c Avoid pip breakage due to keyring
Apparently under linux pip can become fully blocked due to keyring
presence. That is a known open bug, so we apply the workaround until
it is fixed.

Change-Id: I30a5ec1b04b57a5604cb3caa3bc56ea2476e89ba
2020-09-08 11:54:23 +01:00
Sorin Sbarnea 97ca1c24c3 Drop py27 and add py38 jobs
- Dropping py27 as is out of support
- Enable py38 testing, already default python on several distros.
- removes six as a dependency as is no longer needed for pure py3

Change-Id: I1e825073abc6cd55aa2fdc363358f2701152c57b
2020-09-08 10:21:02 +01:00
Sorin Sbarnea 673a054b17 Replace pep8 jobs with linters
Change-Id: I9a59157bf85325a105837828a099915ae79ad003
2020-05-28 10:19:47 +01:00
Sorin Sbarnea f68a8719af Bumped flake8
- Upgraded hacking(flake8)
- Added more modern tox linters environment (pep8 alias)
- Temporary added skips for broken newer rules
- Fixed few basic rule violations
- Moved flake8 config to setup.cfg (tox.ini is not recommended)

Change-Id: I75b3ce5d2ce965a9dc5bdfaa49b2aacd8f0195ad
2020-05-23 08:54:14 +01:00
Matt Riedemann b671bb065a Remove H233 from flake8 ignore list
We support python3 so we can stop ignoring H233.

Change-Id: Ifeda88a3af03a15ea35dd8dc491472df0b3bc7ab
2019-10-16 16:55:47 -04:00
qingszhao b4b819be59 fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: I62e9b6aff712accd3856a3ae0caa0c847aaecbbb
Closes-Bug:  #1801657
2018-11-29 20:18:47 +00:00
Sorin Sbarnea 6c4f466282 Made elastic-recheck py3 compatible
- Adds py36/py37 jobs.
- Fixed invalid syntax errors
- Bumps dependencies to versions that are py3 compatible

Change-Id: I0cebc35993b259cc86470c5ceb1016462a1d649b
Related-Bug: #1803402
2018-11-29 20:15:07 +00:00
Sean Mooney 380c2287ad convert docs to PTI
This change converts the repo to the new PTI workflow
and modernises the docs by using the OpenStack docs theme.

Change-Id: I5a3706c7cf40ee0c3405131b89f956bf75cae244
2018-09-20 06:22:02 +00:00
Zuul 88bad908ec Merge "Revert "Tox allow install of lazr.authentication"" 2018-04-16 14:27:14 +00:00
Matt Riedemann 667b267009 Revert "Tox allow install of lazr.authentication"
This reverts commit bcef6ee2cb.

pip 10 no longer supports "--allow-external":

https://legacy.python.org/dev/peps/pep-0470/

Change-Id: Iba1421af526d32f08ab4df61c5a8c1d5a74399bf
2018-04-16 13:50:05 +00:00
Matthew Treinish 25e6488e75
Switch coverage tox job to use pbr test command
There is some weirdness around the pbr testr command and in some
environments the coverage command doesn't include all the options.
To remedy this lets just use the test command which is what works
everywhere.

Change-Id: I1d1bcb3e17363e4079c865cc1e94256ce2255bed
2016-10-04 10:44:08 -04:00
Cory Benfield 5b632bc2db
Prefer to invoke scripts directly without python.
When executing scripts with a "python" prefix like tox does here, the
directory containing the script is put on the Python path. This is a
problem if any module or file in that directory has the same name as a
Python standard library module, as it means that the module in
elastic-recheck will "shadow" the module in the standard library and be
imported in preference to the stdlib version.

In the case of elastic-recheck, this means that tox -e run does not
actually work: the elastic_recheck.cmd module shadows the stdlib cmd
module, and a long import chain ends up importing pdb which imports the
stdlib cmd module. This ends up causing an AttributeError, leaving the
run environment useless.

However, the script that the run environment wants to invoke is already
installed into the virtual environment by pbr, which means we can simply
invoke it directly and virtualenv will ensure that the correct binary is
invoked.

Change-Id: I6dec4ae58ab10f44c92f94ddb531e6d278d01451
Signed-off-by: Cory Benfield <cory.benfield@hpe.com>
2016-09-28 18:22:28 +01:00
Andreas Jaeger a3763386c9 List system dependencies for running common tests
Add an other-requirements.txt file containing a cross-platform list
of dependencies needed for running included tox-based tests. Also
include a tox environment for convenience calling the bindep[*]
utility to list any missing system requirements.

This change is self-testing.

For other-requirements.txt see also
http://docs.openstack.org/infra/manual/drivers.html#package-requirements

[*] http://docs.openstack.org/infra/bindep/

Change-Id: I3fa07db6a01a045308fbdc517a695f7be2e88014
2016-06-30 08:11:40 +02:00
Joe Gordon 6f7902b48f Update tox environment list
Remove unused tox environments and add used ones.

We don't gate on py26 or pypy support and are not planning on it any
time soon, so remove those environments from the default list.

Remove functional env since we don't use it and add queries environment
since we are now running it as non voting.

Change-Id: I573987ee49dbed7d520137044bbcef267e8761a7
2015-06-11 12:13:15 +03:00
Joe Gordon 2b97c0d156 Upgrade to hacking 0.10.x
Fix up issues detected by new version of hacking

Change-Id: Ie12b9f5ccaa1ce5f49ee6bf35d3275bc9dbcbc15
2015-04-30 17:00:22 -07:00
Joe Gordon 7ac81a0d48 Make test_queries runnable as gating test
Previously test_queries, tested for:

* check if the query has hits
* check if the launchpad bug is open

This wasn't a good test to gate on because hits can go away and bugs can
be closed, so this test can stop working without any code changes,
making it a bad gating test.

Split out getting launchpad test working to a separate patch, still a
few more issues to sort out there.

Change-Id: Ic362d89a0ed34bb14864237e4bc5975befc36497
2015-02-27 13:22:05 -08:00
Jeremy Stanley ce96ae0fc9 Remove unused py33 tox env
It's apparent that elastic-recheck is quite a ways from Py3K
support, and developers are not expected to run the py33 tox env.
Rather than add more envs for later Python interpreter versions
which will be equally broken, just remove it for now.

Change-Id: I6fb62f55d39eb812c585c19f9e16c482775f793a
2014-11-10 14:42:50 +00:00
Matthew Treinish 20871dad7c Fix the coverage job in tox
This commit fixes the coverage job in tox. It relies on pbr to
actually make the coverage calls before and after running the tests.
However, by default pbr assumes the project name in setup.cfg is the
same as the directory containing the source. However that isn't the
case here. This commits corrects this by using the flag to pretend
that package name is the same as the source dir. This change also
sets the correct regex for testr to run the unit tests only, which is
what is needed for the coverage job. The pbr requirement is also
updated to be >=0.8.1 because this is the min version required to
use the option exploited by this patch.

Change-Id: Icea30575538571fe842632901e994be3ac0bbc80
2014-07-28 11:19:48 -04:00
Matt Riedemann 931b4a888b Add tox target for building docs
This is useful for building the docs to verify changes to rst files are
formatted correctly.

Change-Id: Iac3feb50a575f670dd67fd5cd8dabce1a999d97c
2014-06-18 08:06:05 -07:00
Jeremy Stanley 799758410f Remove tox locale overrides
* tox.ini: The LANG, LANGUAGE and LC_ALL environment overrides were
introduced originally during the testr migration in an attempt to be
conservative about the possibility that locale settings in the
calling environment could cause consistency problems for test runs.
In actuality, this should be unnecessary and any place where it does
cause issues ought to be considered an actual bug. Also, having
these in the configuration actively causes older pip to have
problems with non-ASCII content in some package metadata files under
Python 3, so drop it now.

Change-Id: If453210cb0f9117a445a464e18b842a82cace866
Closes-Bug: #1277495
2014-02-10 03:01:36 +00:00
Matthew Treinish d3dc41644d Add --noirc to tox run job
This commit adds the --noirc option to the tox job for running the
bot for testing. This way when testing the bot it won't leave irc
messages.

Change-Id: I923072261bc03022a3c133e1aa425e528be77770
2014-01-24 12:25:05 -05:00
Sean Dague 7f785589a6 refactor bot to be based on argparse
this makes the bot based on argparse, and provides a tox job that
makes running the bot in test mode a little more sane. It also
provides for a new '-n' nocomment item so you can run the bot
and not be worried that it will report to gerrit with findings.

Change-Id: If9d6a7e72dd8d9338f2dd3283cf9a761488122de
2014-01-13 20:00:33 -05:00
Brant Knudson bcef6ee2cb Tox allow install of lazr.authentication
The current tox would fail with an error because it didn't want
to install the lazr.authentication package because it's external.

This change makes it so that tox will allow the install of the
required lazr.authentication package.

Change-Id: I9b766df31f7662e36180188cc699e8665f5d317f
2014-01-06 02:50:14 +00:00
Sean Dague a0be1593f5 Fix E122,E126,E128 items in codebase
In the land of random cleanups, let more of the whitespace rules
back in. Also explicitly exclude E125 because of the overreach,
and leave E123 excluded because it creates some kind of odd
artifacts in the current code (possibly clean it up later).

Tox.ini adjusted with comments about the fact that what we are
ignoring is there for a reason.

Change-Id: I5636cb646d7898df71b715aa0e32a68ce279ee80
2013-12-02 11:43:51 -05:00
Sean Dague a176ec483b time to grow up and fit in 80 columns
elastic_recheck started off life ignoring the 80 column boundary.
We should stop that, as it's bad form. Also, I do multi column
emacs and it blows my column widths.

So fix all the E501 issues and start enforcing the rules in tox

Change-Id: Ib0a1d48d085d9b21fbc1bab75e93e9cc40d36988
2013-12-02 11:43:51 -05:00
Matthew Treinish ac8a3feacd Reorganize tests into unit and functional tests
This commit breaks up the tests into 2 subdirectories, unit and functional.
Functional tests use the network in some way and may require either a
queries file or a functional config. Unit tests do not have these
requirements. In addition the default tox job is changed to only run the
unit tests. The functional tests are give a separate tox job.

Change-Id: I4bdc7f1098bfb7fa16dd869b2e54b3154848c3e1
2013-10-09 13:52:25 -04:00
Joe Gordon 639697808e Apply Cookiecutter to the repo.
Make repo support 'tox -epep8' as we want this to be the first gating
check.
Don't make any actual code changes, just change setup and add files.
Further work is needed to re-organize the code, but that can be in a
separate patch.
2013-09-23 15:27:39 -07:00
Joe Gordon 1004197193 Make Flake8 go Green 2013-09-19 14:57:41 -07:00
Joe Gordon 5727c12482 Fix flake8 issues
Fix some flake8/hacking issues
2013-09-18 15:27:12 -07:00
Joe Gordon bb00befa8d Add tox.ini file for flake8 ignores 2013-09-18 13:47:18 -07:00