Use pytest instead of nosetests

Nose has been in maintenance mode for the past several years
and pytest is a good replacement.

Other changes:
- Replace deprecated assertRegexpMatches with assertRegex
- Replace deprecated assertRaisesRegexp with assertRaisesRegex
- Replace deprecated SafeConfigParser with ConfigParser
- Force reinstall pytest and mock in tox virtualenv. This is because
  the globally installed packages may not work as expected(occured in
  jenkins job).

JIRA: RHELCMP-1619
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
Haibo Lin 2020-07-28 09:23:53 +08:00
parent 495a4c48b2
commit 3c72755814
13 changed files with 51 additions and 54 deletions

View file

@ -9,7 +9,7 @@ PKGRPMFLAGS=--define "_topdir ${PWD}" --define "_specdir ${PWD}" --define "_sour
RPM="noarch/${PKGNAME}-$(VERSION)-$(RELEASE).noarch.rpm"
SRPM="${PKGNAME}-$(VERSION)-$(RELEASE).src.rpm"
NOSE=nosetests
PYTEST=pytest
all: help
@ -95,10 +95,10 @@ clean:
test:
$(NOSE) --exe $(NOSE_OPTS)
$(PYTEST) $(PYTEST_OPTS)
test-coverage:
$(NOSE) --exe --with-cov --cov-report html --cov-config tox.ini $(NOSE_OPTS)
$(PYTEST) --cov=pungi --cov-report term --cov-report html --cov-config tox.ini $(PYTEST_OPTS)
test-data:
./tests/data/specs/build.sh