summaryrefslogtreecommitdiffstats
path: root/tests/parallel/test_parallel.py
diff options
context:
space:
mode:
authorThanh Ha <zxiiro@gmail.com>2019-08-23 09:14:39 -0400
committerSorin Sbarnea <ssbarnea@redhat.com>2019-09-09 19:23:24 +0100
commit4d90c187a945c04b9949d5ee7738a049dd634897 (patch)
tree106bf6e05ad1f2260823e7cd68651b535b8ac3ef /tests/parallel/test_parallel.py
parentead185134d8aa5d3d0974207356de6c4fdb2e6e8 (diff)
downloadpython-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.tar.gz
python-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.tar.xz
python-jenkins-job-builder-4d90c187a945c04b9949d5ee7738a049dd634897.zip
Auto-generated output from python-black
Please review the following patch containing the code changes in the repo. This patch is a transition patch and is the auto-generated output of the python-black tool. Change-Id: I2d2de71da8a105fb62b561899ae78441ddab4032 Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Diffstat (limited to 'tests/parallel/test_parallel.py')
-rw-r--r--tests/parallel/test_parallel.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/parallel/test_parallel.py b/tests/parallel/test_parallel.py
index a3b68092..b7ccd20b 100644
--- a/tests/parallel/test_parallel.py
+++ b/tests/parallel/test_parallel.py
@@ -30,19 +30,18 @@ class TestCaseParallel(TestCase):
def parallel_test(num_base, num_extra):
return num_base + num_extra
- parallel_args = [{'num_extra': num} for num in range(10)]
+ parallel_args = [{"num_extra": num} for num in range(10)]
result = parallel_test(10, concurrent=parallel_args)
self.assertThat(result, matchers.Equals(expected))
def test_parallel_time_less_than_serial(self):
-
@concurrent
def wait(secs):
time.sleep(secs)
before = time.time()
# ten threads to make it as fast as possible
- wait(concurrent=[{'secs': 1} for _ in range(10)], n_workers=10)
+ wait(concurrent=[{"secs": 1} for _ in range(10)], n_workers=10)
after = time.time()
self.assertThat(after - before, matchers.LessThan(5))
@@ -53,18 +52,16 @@ class TestCaseParallel(TestCase):
def parallel_test(num_base, num_extra):
return num_base + num_extra
- parallel_args = [{'num_extra': num} for num in range(10)]
+ parallel_args = [{"num_extra": num} for num in range(10)]
result = parallel_test(10, concurrent=parallel_args, n_workers=1)
self.assertThat(result, matchers.Equals(expected))
- @mock.patch('jenkins_jobs.parallel.cpu_count', wraps=cpu_count)
+ @mock.patch("jenkins_jobs.parallel.cpu_count", wraps=cpu_count)
def test_use_auto_detect_cores(self, mockCpu_count):
-
@concurrent
def parallel_test():
return True
- result = parallel_test(concurrent=[{} for _ in range(10)],
- n_workers=0)
+ result = parallel_test(concurrent=[{} for _ in range(10)], n_workers=0)
self.assertThat(result, matchers.Equals([True for _ in range(10)]))
mockCpu_count.assert_called_once_with()