コード例 #1
0
 def testUnknownRaises(self):
     """Tests that a SystemError will be raised if the cpu count
     is indeterminable."""
     with ou.change_environ('NUMBER_OF_PROCESSORS', None):
         self.assertRaises(SystemError, pu.cpu_count, object())
コード例 #2
0
 def testNoMultiproc(self):
     """Tests that NUMBER_OF_PROCESSORS is used."""
     with ou.change_environ('NUMBER_OF_PROCESSORS', '13'):
         self.assertEqual(13, pu.cpu_count(object()))
コード例 #3
0
ファイル: test_osutils.py プロジェクト: ccpgames/brennivin
 def testDeletesIfItIsNew(self):
     self.assertNotIn('blah', os.environ)
     with osutils.change_environ('blah', 'f'):
         self.assertEqual(os.environ['blah'], 'f')
     self.assertNotIn('blah', os.environ)
コード例 #4
0
ファイル: test_osutils.py プロジェクト: ccpgames/brennivin
 def testReentrancy(self):
     # Will lock if not reentrant
     with osutils.change_environ('blah', 'f'):
         with osutils.change_environ('spam', 'e'):
             pass
コード例 #5
0
ファイル: test_osutils.py プロジェクト: ccpgames/brennivin
 def _changeAndTest(self, doRaise=False):
     with osutils.change_environ('TESTVALUE', 'XYZ'):
         self.assertEqual(os.environ['TESTVALUE'], 'XYZ')
         if doRaise:
             raise SystemError