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

---
 .travis.yml                          | 14 +++++++-------
 Dockerfile                           | 10 ++++++++--
 setup.py                             |  4 +++-
 tests/test_coding/test_structures.py |  4 ++--
 tests/test_docker.sh                 |  3 +--
 tests/test_os/test_suicide.py        |  1 +
 unittest.cfg                         |  6 ++++++
 7 files changed, 28 insertions(+), 14 deletions(-)
 create mode 100644 unittest.cfg

diff --git a/.travis.yml b/.travis.yml
index 52e6432c..adb0d2d5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,48 +10,48 @@ before_script:
   - chmod +x ./cc-test-reporter
   - ./cc-test-reporter before-build
   - pip install -r requirements.txt
-  - pip install coverage nose2
+  - pip install coverage nose2 nose2[coverage]
 jobs:
   include:
     - stage: test
       python: "3.5"
       script:
-        - coverage run -m nose2 -v
+        - nose2 -vv
       after_script:
         - coverage xml
         - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
     - stage: test
       python: "3.6"
       script:
-        - coverage run -m nose2 -v
+        - nose2 -vv
       after_script:
         - coverage xml
         - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
     - stage: test
       python: "3.7"
       script:
-        - coverage run -m nose2 -v
+        - nose2 -vv
       after_script:
         - coverage xml
         - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
     - stage: test
       python: "3.8"
       script:
-        - coverage run -m nose2 -v
+        - nose2 -vv
       after_script:
         - coverage xml
         - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
     - stage: test
       python: "nightly"
       script:
-        - coverage run -m nose2 -v
+        - nose2 -vv
       after_script:
         - coverage xml
         - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
     - stage: test
       python: "pypy3.5"
       script:
-        - coverage run -m nose2 -v
+        - nose2 -vv
       after_script:
         - coverage xml
         - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
diff --git a/Dockerfile b/Dockerfile
index 36434cf8..fae211e4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,17 @@
 FROM python:3.8
 
 ADD requirements.txt /app/requirements.txt
-RUN pip install -r /app/requirements.txt
-RUN pip install nose2 mock coverage
+RUN pip install -r /app/requirements.txt && \
+    pip install nose2 mock coverage nose2[mp] nose2[coverage_plugin]
 
 ADD satella /app/satella
 ADD tests /app/tests
+ADD unittest.cfg /app/unittest.cfg
+ADD setup.py /app/setup.py
+ADD setup.cfg /app/setup.cfg
+ADD LICENSE /app/LICENSE
+ADD README.md /app/README.md
+ADD MANIFEST.in /app/MANIFEST.in
 
 ADD tests/test_docker.sh /test_docker.sh
 RUN chmod ugo+x /test_docker.sh
diff --git a/setup.py b/setup.py
index 0f4d265a..afee25ba 100644
--- a/setup.py
+++ b/setup.py
@@ -1,13 +1,15 @@
 from setuptools import setup, find_packages
-
+import unittest
 from satella import __version__
 
+
 setup(keywords=['ha', 'high availability', 'scalable', 'scalability', 'server', 'metrics'],
       packages=find_packages(include=['satella', 'satella.*']),
       version=__version__,
       install_requires=[
             'psutil'
       ],
+      test_suite='nose2.collector.collector',
       python_requires='!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
       extras_require={
             'HTTPJSONSource': ['requests'],
diff --git a/tests/test_coding/test_structures.py b/tests/test_coding/test_structures.py
index 1659c78b..27b4ef20 100644
--- a/tests/test_coding/test_structures.py
+++ b/tests/test_coding/test_structures.py
@@ -259,8 +259,8 @@ class TestMisc(unittest.TestCase):
             def __init__(self, v):
                 self.v = v
 
-        self.assertEqual(repr(Test2(2)),
-                         'tests.test_coding.test_structures.TestMisc.test_reprable_mixin.<locals>.Test2(2)')
+        self.assertTrue(repr(Test2(2)).endswith(
+            'test_coding.test_structures.TestMisc.test_reprable_mixin.<locals>.Test2(2)'))
 
     def test_proxy(self):
         a = Proxy(5, wrap_operations=True)
diff --git a/tests/test_docker.sh b/tests/test_docker.sh
index e0c45d05..7af14169 100644
--- a/tests/test_docker.sh
+++ b/tests/test_docker.sh
@@ -1,6 +1,5 @@
 #!/bin/bash
 set -e
 
-coverage run --parallel-mode -m nose2 -vv
-coverage combine
+nose2 -vv
 coverage report
diff --git a/tests/test_os/test_suicide.py b/tests/test_os/test_suicide.py
index e9cc6688..ec28e6f6 100644
--- a/tests/test_os/test_suicide.py
+++ b/tests/test_os/test_suicide.py
@@ -6,6 +6,7 @@ from satella.os.misc import suicide
 
 
 class TestSuicide(unittest.TestCase):
+    @unittest.skipIf('linux' in sys.platform, 'Running on Linux')
     @unittest.skipIf('win' in sys.platform, 'Running on Windows')
     def test_suicide(self):
         pcid = os.fork()
diff --git a/unittest.cfg b/unittest.cfg
new file mode 100644
index 00000000..36e5d469
--- /dev/null
+++ b/unittest.cfg
@@ -0,0 +1,6 @@
+[unittest]
+plugins =
+    nose2.plugins.coverage
+
+[coverage]
+always-on = True
-- 
GitLab