From ac8c4b67434129384cbcbc73967b669de7814bd2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Sat, 11 Jul 2020 03:20:19 +0200
Subject: [PATCH] fix tests

---
 .gitattributes                |  1 +
 Dockerfile                    |  5 ++++-
 satella/cassandra/__init__.py | 10 +++++++---
 satella/os/signals.py         |  3 ++-
 tests/test_docker.sh          |  6 ++++++
 5 files changed, 20 insertions(+), 5 deletions(-)
 create mode 100644 tests/test_docker.sh

diff --git a/.gitattributes b/.gitattributes
index 412eeda7..c03370bd 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,5 +1,6 @@
 # Auto detect text files and perform LF normalization
 * text=auto
+*.sh text eol=lf
 
 # Custom for Visual Studio
 *.cs     diff=csharp
diff --git a/Dockerfile b/Dockerfile
index 23e3c957..36434cf8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,6 +7,9 @@ RUN pip install nose2 mock coverage
 ADD satella /app/satella
 ADD tests /app/tests
 
+ADD tests/test_docker.sh /test_docker.sh
+RUN chmod ugo+x /test_docker.sh
+
 WORKDIR /app
 
-CMD ["coverage", "run", "--multiprocessing", "-m", "nose2", "-vv"]
+CMD ["/test_docker.sh"]
diff --git a/satella/cassandra/__init__.py b/satella/cassandra/__init__.py
index 15cdab0e..97912507 100644
--- a/satella/cassandra/__init__.py
+++ b/satella/cassandra/__init__.py
@@ -29,12 +29,16 @@ def parallel_for(cursor, query: tp.Union[tp.List[str], str, 'Statement', tp.List
     :param query: base query or a list of queries, if a different one is to be used
     :param arguments: iterable yielding arguments to use in execute_async
     """
-    from cassandra.query import Statement
+    try:
+        from cassandra.query import Statement
+        query_classes = (str, Statement)
+    except ImportError:
+        query_classes = str
 
-    if isinstance(query, (str, Statement)):
+    if isinstance(query, query_classes):
         query = itertools.repeat(query)
-    futures = []
 
+    futures = []
     for query, args in zip(query, arguments):
         if args is None:
             future = cursor.execute_async(query)
diff --git a/satella/os/signals.py b/satella/os/signals.py
index b924de56..62a57475 100644
--- a/satella/os/signals.py
+++ b/satella/os/signals.py
@@ -1,7 +1,8 @@
 import signal
-from satella.time import sleep
 import typing as tp
 
+from satella.time import sleep
+
 end = False
 
 
diff --git a/tests/test_docker.sh b/tests/test_docker.sh
new file mode 100644
index 00000000..e0c45d05
--- /dev/null
+++ b/tests/test_docker.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -e
+
+coverage run --parallel-mode -m nose2 -vv
+coverage combine
+coverage report
-- 
GitLab