37 Commits

Author SHA1 Message Date
Brendan Reilly
3c0c7d3029 Also run bandit during py3 unit tests 2022-03-22 13:55:27 -04:00
jobrauer
6400b64741 Add test_memory
- Add a script that runs test MBS instance.
- Add memory tracking test-case.
- New tox environment: run with 'tox -e memory'.
2020-08-18 14:48:49 +02:00
jobrauer
98ed3abc72 Add test_import_module 2020-04-24 13:43:33 +02:00
Hunor Csomortáni
f35935c143 Add rpm-py-installer as a dependency for the integration tests
'rpm' is an optional dependency for kobo, which is required by the
integration tests.

Previously this dependency was implicitly satisfied by 'koji' pulling
in 'rpm-py-installer' which made sure 'rpm' is available. But
koji==1.20.0 made this dependency optional, so importing kobo.rpmlib
started failing.

Fix this by making 'rpm-py-installer' and explicit dependency for the
integration test environment.

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2020-01-21 10:30:21 +01:00
Hunor Csomortáni
30215a1ac5 Tests: improve reporting when running with tox
Generate a short report at the end of each test run and a self-contained
HTML report, too.

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2019-12-06 12:33:44 +01:00
Mariana Ulaieva
4c8a92cb93 Integration test for the Cancel And Resume
Implement the integration test for the Cancel and Resume scenario.
2019-11-29 13:45:40 +01:00
Hunor Csomortáni
0f0e809467 Tests: allow running integration tests in parallel
This is done in order to speed up test execution.

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2019-11-20 16:47:12 +01:00
Matt Prahl
52fe1e308e Merge #1496 Upgrade Vagrant to use Fedora 31 2019-11-13 15:03:55 +00:00
Hunor Csomortáni
f5bf0d7252 Add integration test to check scratch module builds
Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2019-11-07 14:30:53 +01:00
Hunor Csomortáni
8c0521cde3 Lint the integration tests with Python 3
The integration tests under 'tests/integration' are Python 3 only.
Flake8 will fail on Python 3 syntax when running under Python 2, but for
now we wouldn't like to change this, in order to keep Python 2
compatibility of the code base.

To work around the above, set up a separate tox environment to lint the
integration tests, and exclude linting the integration tests when the
rest of the code is checked.

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2019-11-07 14:30:49 +01:00
mprahl
ea890bc706 Whitelist the pytest binary that's actually used in tox.ini 2019-11-06 17:47:37 -05:00
Hunor Csomortáni
0066c79dae Bootstrap integration tests
This is the first step to have some tests, that we could run against an
MBS instance, to check that it's functionally correct. Ultimately, these
will replace the test scripts (`contrib/test-*`).

This doesn't really do anything yet, but I would like to make sure that
everyone is on the same page regarding how this will be set up.

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2019-10-24 10:16:16 +02:00
Chenxiong Qi
dd1f918920 Show test coverage
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-09-10 23:02:36 +08:00
Chenxiong Qi
630f7b4e18 Allow to run tests with PostgreSQL inside container
This patch introduces a new environment variable in order to allow running
tests with different database backend. This is useful particularly for running
tests inside container. With this change, it is possible run tests in following
combinations:

* Python 2 and SQLite
* Python 3 and SQLite
* Python 2 and PostgreSQL
* Python 3 and PostgreSQL

Package python-psycopg2 is installed in both Dockerfile-tests and
Dockerfile-tests-py3 in case of running tests with PostgreSQL.

A new script contrib/run-unittests.sh is added to make it easy to run tests. An
example:

    contrib/run-unittests.sh --py3 --with-pgsql

that runs tests with Python 3 and PostgreSQL.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-06-17 22:47:23 +08:00
mprahl
66c3f82160 Format the coding style across the codebase using "black" and manual tweaks
The main benefit of this commit is that the use of double quotes
is now consistent.
2019-04-26 00:32:13 -04:00
mprahl
0044b3f34b Whitelist py.test-3 in tox 2019-04-03 15:33:16 -04:00
mprahl
d46ce667cf Whitelist flake8 in tox 2019-04-03 15:24:20 -04:00
Filip Valder
14f1b582c9 Ignore some SQLAlchemy DeprecationWarnings 2019-03-12 22:00:53 +01:00
Chenxiong Qi
f9fda3f1c5 Add W504 to flake8 ignore list
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-10-25 16:31:55 +08:00
Chenxiong Qi
5ae0122b18 Move flake8 config into flake8 section in tox.ini
Sometimes, it would be convenient to run flake8 directly rather than
`tox -e flake8` and the flake8 section in tox.ini will apply to both of
them.

In addition, exclude ./.env as well.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-10-22 09:45:04 +08:00
mprahl
20d68628d2 Add a Dockerfile for running unit tests on CentOS 2018-04-03 09:58:57 -04:00
Jan Kaluza
e5e9a24fce Allow adding bool to XMD. Fix flake8 issues. 2018-04-03 09:58:57 -04:00
Jan Kaluža
e7587cb77b add MMDResolver to find possible combinations between modules
Using libsolv for solving part and libmodulemd for getting the data.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2018-04-03 09:58:57 -04:00
Yash Nanavati
ed25afd9ec Code changes for Python 3 support 2018-03-04 03:22:38 -05:00
mprahl
d6fd203ac0 Disable tox envs that we don't use 2018-02-09 09:16:49 -05:00
mprahl
63e39232a4 Add "-v" to the pytest command when run in tox 2018-02-05 22:11:31 -05:00
mprahl
5795a5017a Don't ignore the tox flake8 test 2018-02-05 22:11:31 -05:00
mprahl
bc4a612b38 Stop using site_packages when running tox 2018-01-08 08:59:14 -05:00
mprahl
fa44d53d8d Make the pytest command verbose in tox.ini 2017-11-07 11:30:45 -05:00
Martin Curlej
60b3d97c97 flake8 cleanup
Signed-off-by: Martin Curlej <mcurlej@redhat.com>

removed some noqa tags
2017-10-25 12:13:59 +02:00
mprahl
bd06a803d1 Set the max line length used by the project in tox.ini so flake8 doesn't complain 2017-10-16 14:38:42 -04:00
Filip Valder
7e3914e8b3 Remove parameterized
The reason is mentioned in PR#684:
"I've talked with @fivaldi to rewrite the test to not use parameterized,
since it is not in Fedora."
2017-09-15 13:31:48 +02:00
Filip Valder
3cb41aa5dc Changes in MBS restful API:
- Refactor MBS API code
- Unify module-/component_build API philosophy/design/approach
- Naming fixes
- _utc_datetime_to_iso moved from ModuleBuildAPI and is now a module-level function.
- Existing v1 API remains unchanged. ComponentBuildAPI now supports individual component build listing + verbose mode.
- documented in README
- various component_build API tests added
2017-09-11 14:48:22 +02:00
Filip Valder
83abaa4f6c tox fixes 2017-05-10 13:33:13 +02:00
Filip Valder
906bef4e6a add posargs for passing additional args to py.test (e.g. run tests in specific file/dir only) 2017-04-07 10:36:50 +02:00
Filip Valder
41eaa2b001 include all other deps from test-requirements 2017-03-31 11:29:12 +02:00
Filip Valder
e6d80c0293 introduce tox & pytest as well as other stuff (flake8, bandit and prepare for future automated build&release steps) 2017-03-31 11:15:32 +02:00