5
5
from multiprocessing import Queue , cpu_count
6
6
import unittest
7
7
import warnings
8
- import sys
9
8
10
9
from hypothesis import given , example , settings
11
10
from hypothesis .strategies import integers , floats
@@ -190,7 +189,7 @@ def test_progress_bar_play(self):
190
189
self .assertIsInstance (results , axelrod .ResultSet )
191
190
self .assertEqual (tournament .progress_bar .total , 15 )
192
191
193
- @unittest .skipIf (sys . platform . startswith ( "win" ) ,
192
+ @unittest .skipIf (axelrod . on_windows ,
194
193
"Parallel processing not supported on Windows" )
195
194
def test_progress_bar_play_parallel (self ):
196
195
"""Test that tournament plays when asking for progress bar for parallel
@@ -237,7 +236,7 @@ def test_property_serial_play(self, tournament):
237
236
self .assertEqual (results .nplayers , len (tournament .players ))
238
237
self .assertEqual (results .players , [str (p ) for p in tournament .players ])
239
238
240
- @unittest .skipIf (sys . platform . startswith ( "win" ) ,
239
+ @unittest .skipIf (axelrod . on_windows ,
241
240
"Parallel processing not supported on Windows" )
242
241
def test_parallel_play (self ):
243
242
# Test that we get an instance of ResultSet
@@ -279,7 +278,7 @@ def test_run_serial(self):
279
278
calls = tournament ._write_interactions .call_args_list
280
279
self .assertEqual (len (calls ), 15 )
281
280
282
- @unittest .skipIf (sys . platform . startswith ( "win" ) ,
281
+ @unittest .skipIf (axelrod . on_windows ,
283
282
"Parallel processing not supported on Windows" )
284
283
def test_run_parallel (self ):
285
284
tournament = axelrod .Tournament (
@@ -296,7 +295,7 @@ def test_run_parallel(self):
296
295
calls = tournament ._write_interactions .call_args_list
297
296
self .assertEqual (len (calls ), 15 )
298
297
299
- @unittest .skipIf (sys . platform . startswith ( "win" ) ,
298
+ @unittest .skipIf (axelrod . on_windows ,
300
299
"Parallel processing not supported on Windows" )
301
300
def test_n_workers (self ):
302
301
max_processes = cpu_count ()
@@ -318,7 +317,7 @@ def test_n_workers(self):
318
317
self .assertEqual (tournament ._n_workers (processes = max_processes + 2 ),
319
318
max_processes )
320
319
321
- @unittest .skipIf (sys . platform . startswith ( "win" ) ,
320
+ @unittest .skipIf (axelrod . on_windows ,
322
321
"Parallel processing not supported on Windows" )
323
322
@unittest .skipIf (
324
323
cpu_count () < 2 ,
@@ -335,7 +334,7 @@ def test_2_workers(self):
335
334
repetitions = self .test_repetitions ,)
336
335
self .assertEqual (tournament ._n_workers (processes = 2 ), 2 )
337
336
338
- @unittest .skipIf (sys . platform . startswith ( "win" ) ,
337
+ @unittest .skipIf (axelrod . on_windows ,
339
338
"Parallel processing not supported on Windows" )
340
339
def test_start_workers (self ):
341
340
workers = 2
@@ -359,7 +358,7 @@ def test_start_workers(self):
359
358
stops += 1
360
359
self .assertEqual (stops , workers )
361
360
362
- @unittest .skipIf (sys . platform . startswith ( "win" ) ,
361
+ @unittest .skipIf (axelrod . on_windows ,
363
362
"Parallel processing not supported on Windows" )
364
363
def test_worker (self ):
365
364
tournament = axelrod .Tournament (
0 commit comments