File: Make_unittests_loadable.patch

package info (click to toggle)
python-cassandra-driver 3.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,840 kB
  • sloc: python: 50,759; ansic: 771; makefile: 132
file content (41 lines) | stat: -rw-r--r-- 1,454 bytes parent folder | download
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
From: Adam Cecile <acecile@le-vert.net>
Date: Thu, 4 Feb 2021 22:02:00 -0300
Subject: UnitTest cannot be run at all without CCM

Because this third party module is imported from __init__ files breaking
nose while analysing available test (so --ignore-file cannot help)
Author: Adam Cecile <acecile@le-vert.net>
---
 tests/integration/__init__.py         | 2 +-
 tests/integration/upgrade/__init__.py | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py
index 1e1f582..1c403d4 100644
--- a/tests/integration/__init__.py
+++ b/tests/integration/__init__.py
@@ -47,7 +47,7 @@ try:
     from ccmlib.cluster_factory import ClusterFactory as CCMClusterFactory
     from ccmlib import common
 except ImportError as e:
-    CCMClusterFactory = None
+    raise unittest.SkipTest('ccm is a dependency for integration tests:', e)
 
 log = logging.getLogger(__name__)
 
diff --git a/tests/integration/upgrade/__init__.py b/tests/integration/upgrade/__init__.py
index d2b9076..f782a75 100644
--- a/tests/integration/upgrade/__init__.py
+++ b/tests/integration/upgrade/__init__.py
@@ -23,7 +23,10 @@ from collections import namedtuple
 from functools import wraps
 import logging
 from threading import Thread, Event
-from ccmlib.node import TimeoutError
+try:
+    from ccmlib.node import TimeoutError
+except ImportError:
+    TimeoutError = Exception
 import time
 import logging