From af7fa5d40c17b31dff1ae46e8607b73590571c12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rajmund=20Hru=C5=A1ka?= <rajmund.hruska@cesnet.cz>
Date: Mon, 27 Jun 2022 12:57:41 +0200
Subject: [PATCH] Feature: Use nose2 instead of nose. (Redmine issue: #7587)

---
 .gitignore                       | 3 +++
 Makefile                         | 2 +-
 conf/requirements-dev.pip        | 2 +-
 conf/requirements-latest-dev.pip | 2 +-
 nose2.cfg                        | 2 ++
 5 files changed, 8 insertions(+), 3 deletions(-)
 create mode 100644 nose2.cfg

diff --git a/.gitignore b/.gitignore
index 2031b28e..c7a8b228 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,9 @@ pip-delete-this-directory.txt
 # Ignore compiled translations catalogs.
 messages.mo
 
+# Ignore test results.
+nose2-junit.xml
+
 # Ignore precompiled files for PLY.
 parser.out
 parsetab.py
diff --git a/Makefile b/Makefile
index 3af8ba76..8cca7ee6 100644
--- a/Makefile
+++ b/Makefile
@@ -606,7 +606,7 @@ pylint: FORCE
 test: FORCE
 	@echo "\n$(GREEN)*** Checking code with nosetests ***$(NC)\n"
 	@echo "Python version: `$(PYTHON) --version`"
-	APP_ROOT_PATH=$(shell realpath ./chroot) PYTHONPATH=$(DIR_LIB) $(NOSETESTS)
+	APP_ROOT_PATH=$(shell realpath ./chroot) PYTHONPATH=$(DIR_LIB) $(PYTHON) -W always::DeprecationWarning -m nose2
 
 coverage: FORCE
 	@echo "\n$(GREEN)*** Checking test code coverage with nosetests and coverage ***$(NC)\n"
diff --git a/conf/requirements-dev.pip b/conf/requirements-dev.pip
index b24db6d2..70218ab2 100644
--- a/conf/requirements-dev.pip
+++ b/conf/requirements-dev.pip
@@ -1,6 +1,6 @@
 setuptools==46.1.3
 wheel==0.34.2
-nose==1.3.7
+nose2==0.11.0
 coverage==5.0.4
 pyflakes==2.1.1
 pylint==2.4.4
diff --git a/conf/requirements-latest-dev.pip b/conf/requirements-latest-dev.pip
index a285ea71..10579462 100644
--- a/conf/requirements-latest-dev.pip
+++ b/conf/requirements-latest-dev.pip
@@ -1,6 +1,6 @@
 setuptools
 wheel
-nose
+nose2
 coverage
 pyflakes
 pylint
diff --git a/nose2.cfg b/nose2.cfg
new file mode 100644
index 00000000..a7850f00
--- /dev/null
+++ b/nose2.cfg
@@ -0,0 +1,2 @@
+[unittest]
+plugins = nose2.plugins.junitxml
-- 
GitLab