summaryrefslogtreecommitdiffhomepage
path: root/test/run.py
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-02-04 11:39:34 +0300
committerMax Romanov <max.romanov@nginx.com>2020-02-04 11:39:34 +0300
commit81b39d0b35d78daabf479ccd492ae8323039b7cb (patch)
tree53708f86c3e46dc9813aaf56d38cbe2fb486c0c8 /test/run.py
parent7c38650cd12b9d5b14aec5d416fa3b57918cee50 (diff)
downloadunit-81b39d0b35d78daabf479ccd492ae8323039b7cb.tar.gz
unit-81b39d0b35d78daabf479ccd492ae8323039b7cb.tar.bz2
Tests: fixing Python 3.8.1 errors on Mac.
- "Can't pickle local object ..." - "if __name__ == '__main__':" pattern required for multiprocessing
Diffstat (limited to '')
-rwxr-xr-xtest/run.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/run.py b/test/run.py
index 0504a6f7..b79d0484 100755
--- a/test/run.py
+++ b/test/run.py
@@ -4,16 +4,17 @@ import unittest
import sys
import os
-loader = unittest.TestLoader()
-suite = unittest.TestSuite()
+if __name__ == '__main__':
+ loader = unittest.TestLoader()
+ suite = unittest.TestSuite()
-this_dir = os.path.dirname(__file__)
-tests = loader.discover(start_dir=this_dir)
-suite.addTests(tests)
+ this_dir = os.path.dirname(__file__)
+ tests = loader.discover(start_dir=this_dir)
+ suite.addTests(tests)
-runner = unittest.TextTestRunner(verbosity=3)
-result = runner.run(suite)
+ runner = unittest.TextTestRunner(verbosity=3)
+ result = runner.run(suite)
-ret = not (len(result.failures) == len(result.errors) == 0)
+ ret = not (len(result.failures) == len(result.errors) == 0)
-sys.exit(ret)
+ sys.exit(ret)