File: fix-init_once-tests_2.diff

package info (click to toggle)
libcloud 3.8.0%2Brepack-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,760 kB
  • sloc: python: 158,354; xml: 19,482; sh: 27; makefile: 11
file content (58 lines) | stat: -rw-r--r-- 2,226 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Index: libcloud/libcloud/test/test_init.py
===================================================================
--- libcloud.orig/libcloud/test/test_init.py
+++ libcloud/libcloud/test/test_init.py
@@ -20,6 +20,7 @@ import tempfile
 from unittest import mock
 from unittest.mock import patch
 
+import pytest
 import libcloud
 from libcloud import _init_once, reset_debug
 from libcloud.base import DriverTypeNotFoundError
@@ -42,12 +43,14 @@ class TestUtils(unittest.TestCase):
         # Reset debug level
         reset_debug()
 
-        # Reset paramiko log level
+        # Reset paramiko log level and handlers
         if have_paramiko:
             paramiko_logger = logging.getLogger("paramiko")
+            paramiko_logger.handlers = []
             paramiko_logger.setLevel(logging.INFO)
 
     @mock.patch.dict(os.environ, {"LIBCLOUD_DEBUG": ""}, clear=True)
+    @pytest.mark.serial
     def test_init_once_and_no_debug_mode(self):
         if have_paramiko:
             paramiko_logger = logging.getLogger("paramiko")
@@ -68,6 +71,7 @@ class TestUtils(unittest.TestCase):
             self.assertEqual(paramiko_log_level, logging.INFO)
 
     @mock.patch.dict(os.environ, {"LIBCLOUD_DEBUG": TEMP_LOGFILE_PATH}, clear=True)
+    @pytest.mark.serial
     def test_init_once_and_debug_mode(self):
         if have_paramiko:
             paramiko_logger = logging.getLogger("paramiko")
Index: libcloud/tox.ini
===================================================================
--- libcloud.orig/tox.ini
+++ libcloud/tox.ini
@@ -380,7 +380,7 @@ deps =
 setenv =
   CRYPTOGRAPHY_ALLOW_OPENSSL_102=1
 commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
-           coverage run --source=libcloud -m pytest --benchmark-disable
+           coverage run --source=libcloud -m pytest --benchmark-disable -m "not serial"
 
 [testenv:coverage-ci]
 passenv =
@@ -393,7 +393,7 @@ deps =
 setenv =
   CRYPTOGRAPHY_ALLOW_OPENSSL_102=1
 commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
-           coverage run --source=libcloud -m pytest --benchmark-disable
+           coverage run --source=libcloud -m pytest --benchmark-disable -m "not serial"
            coverage xml
 
 [testenv:isort]