From 53aa3e33ad40d692ef03de66418b3d9c19308bc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rajmund=20Hru=C5=A1ka?= <rajmund.hruska@cesnet.cz>
Date: Tue, 21 Jun 2022 10:51:51 +0000
Subject: [PATCH] Feature: Check deprecation warnings

---
 .gitlab-ci.yml | 12 +++++++++++-
 Makefile       |  2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1d41e52..dfcba0f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,15 +26,18 @@ before_script:
 
 stages:          # List of stages for jobs, and their order of execution
   - test
+  - check-warnings
   - build
   - deploy
 
 unit-test-job:  
   stage: test
   script:
-    - make test
+    - make test 2>&1 | tee errors.log
   artifacts:
     when: always
+    paths:
+      - errors.log
     reports:
       junit: nosetests.xml
 
@@ -48,6 +51,13 @@ pyflakes-test-job:
   script:
     - make pyflakes
 
+check-deprecation-warnings:
+  before_script: []
+  stage: check-warnings
+  script:
+    - "if [[ $(grep DeprecationWarning errors.log) ]]; then cat errors.log; exit 1; fi"
+  allow_failure: true
+
 build-job:
   stage: build
   script:
diff --git a/Makefile b/Makefile
index 54ccd00..24074e6 100644
--- a/Makefile
+++ b/Makefile
@@ -158,7 +158,7 @@ pylint-test: FORCE
 
 test: FORCE
 	@echo "\n${GREEN}*** Checking code with nosetests ***${NC}\n"
-	@nosetests test_idea.py --with-xunit
+	@python3 -W always::DeprecationWarning -m nose test_idea.py --with-xunit
 
 
 #-------------------------------------------------------------------------------
-- 
GitLab