Skip to content

Commit

Permalink
Replace python-nose with unittest
Browse files Browse the repository at this point in the history
This also needed setting locale for testing, because for some reason,
the default locale is different when running unittest instead of
python-nose.

= changelog =
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1916783
  • Loading branch information
pkratoch authored and lukash committed Mar 9, 2021
1 parent ba5173d commit 0c99a11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion dnf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ BuildRequires: python3-libcomps >= %{libcomps_version}
BuildRequires: python3-libdnf
BuildRequires: libmodulemd >= %{libmodulemd_version}
Requires: libmodulemd >= %{libmodulemd_version}
BuildRequires: python3-nose
BuildRequires: python3-gpg
Requires: python3-gpg
Requires: %{name}-data = %{version}-%{release}
Expand Down
5 changes: 4 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
ADD_TEST(test ${PYTHON_EXECUTABLE} -m nose -s ${CMAKE_CURRENT_SOURCE_DIR})
ADD_TEST(
NAME test
COMMAND ${PYTHON_EXECUTABLE} -m unittest discover -s tests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})

# For libdnf built with sanitizers, has no effect otherwise.
# dnf tests do some wild stuff and cause a lot of leaks, hence turn leak
Expand Down
2 changes: 2 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
# Red Hat, Inc.
#

import locale
import os

# run tests with C locales
os.environ["LC_ALL"] = "C.UTF-8"
os.environ["LANG"] = "C.UTF-8"
os.environ["LANGUAGE"] = "en_US:en"
locale.setlocale(locale.LC_ALL, "C.UTF-8")

0 comments on commit 0c99a11

Please sign in to comment.