From 902dcfcb60588decfaa34d5f88d87256ec0c109e Mon Sep 17 00:00:00 2001
From: Julen Landa Alustiza <jlanda@fedoraproject.org>
Date: Oct 24 2019 06:52:08 +0000
Subject: [PATCH 1/2] tests: a try except block on tearDown to prevent failing tests due to directory removing race conditions


---

diff --git a/tests/test_pagure_flask_ui_pr_edit.py b/tests/test_pagure_flask_ui_pr_edit.py
index d60db95..af6630b 100644
--- a/tests/test_pagure_flask_ui_pr_edit.py
+++ b/tests/test_pagure_flask_ui_pr_edit.py
@@ -97,8 +97,11 @@ class PagureFlaskPrEdittests(tests.Modeltests):
         )
 
     def tearDown(self):
+        try:
+            tests.clean_pull_requests_path()
+        except:
+            pass
         super(PagureFlaskPrEdittests, self).tearDown()
-        tests.clean_pull_requests_path()
 
     def test_pr_edit_pull_request_unauthenticated(self):
         output = self.app.get("/test/pull-request/1/edit")

From f92d829f03542b238bc1aa8ea7e850d7ffd87554 Mon Sep 17 00:00:00 2001
From: Julen Landa Alustiza <jlanda@fedoraproject.org>
Date: Oct 24 2019 08:09:40 +0000
Subject: [PATCH 2/2] test_pagure_admin: remove conditional test skipping


---

diff --git a/tests/test_pagure_admin.py b/tests/test_pagure_admin.py
index e9fd059..753d689 100644
--- a/tests/test_pagure_admin.py
+++ b/tests/test_pagure_admin.py
@@ -434,9 +434,6 @@ class PagureAdminAdminTokentests(tests.Modeltests):
     @patch("pagure.cli.admin._ask_confirmation")
     def test_do_expire_admin_token(self, conf, rinp):
         """ Test the do_expire_admin_token function of pagure-admin. """
-        if "BUILD_ID" in os.environ:
-            raise unittest.case.SkipTest("Skipping on jenkins/el7")
-
         # Create an admin token to use
         conf.return_value = True
         rinp.return_value = "1,2,3"
@@ -504,8 +501,6 @@ class PagureAdminAdminTokentests(tests.Modeltests):
     def test_do_expire_admin_token_non_admin_acls(self, conf, rinp):
         """ Test the do_expire_admin_token function of pagure-admin for a token
         without any admin ACL. """
-        if "BUILD_ID" in os.environ:
-            raise unittest.case.SkipTest("Skipping on jenkins/el7")
 
         # Create an admin token to use
         conf.return_value = True
@@ -561,8 +556,6 @@ class PagureAdminAdminTokentests(tests.Modeltests):
     def test_do_update_admin_token_invalid_date(self, conf, rinp):
         """ Test the do_update_admin_token function of pagure-admin with
         an invalid date. """
-        if "BUILD_ID" in os.environ:
-            raise unittest.case.SkipTest("Skipping on jenkins/el7")
 
         # Create an admin token to use
         conf.return_value = True
@@ -604,8 +597,6 @@ class PagureAdminAdminTokentests(tests.Modeltests):
     def test_do_update_admin_token_invalid_date2(self, conf, rinp):
         """ Test the do_update_admin_token function of pagure-admin with
         an invalid date. """
-        if "BUILD_ID" in os.environ:
-            raise unittest.case.SkipTest("Skipping on jenkins/el7")
 
         # Create an admin token to use
         conf.return_value = True
@@ -649,8 +640,6 @@ class PagureAdminAdminTokentests(tests.Modeltests):
     def test_do_update_admin_token_invalid_date3(self, conf, rinp):
         """ Test the do_update_admin_token function of pagure-admin with
         an invalid date (is today). """
-        if "BUILD_ID" in os.environ:
-            raise unittest.case.SkipTest("Skipping on jenkins/el7")
 
         # Create an admin token to use
         conf.return_value = True
@@ -697,8 +686,6 @@ class PagureAdminAdminTokentests(tests.Modeltests):
     @patch("pagure.cli.admin._ask_confirmation")
     def test_do_update_admin_token(self, conf, rinp):
         """ Test the do_update_admin_token function of pagure-admin. """
-        if "BUILD_ID" in os.environ:
-            raise unittest.case.SkipTest("Skipping on jenkins/el7")
 
         # Create an admin token to use
         conf.return_value = True
@@ -781,8 +768,6 @@ class PagureAdminAdminTokentests(tests.Modeltests):
     def test_do_update_admin_token_non_admin_acls(self, conf, rinp):
         """ Test the do_update_admin_token function of pagure-admin for a token
         without any admin ACL. """
-        if "BUILD_ID" in os.environ:
-            raise unittest.case.SkipTest("Skipping on jenkins/el7")
 
         # Create an admin token to use
         conf.return_value = True

