Commits

Aleš Erjavec  committed 50d23c6

Test that the act of importing Orange does not change the global random seed.

  • Participants
  • Parent commits c03ea83

Comments (0)

Files changed (1)

File Orange/testing/unit/tests/test_random.py

+try:
+    import unittest2 as unittest
+except ImportError:
+    import unittest
+    
+class TestImportSanity(unittest.TestCase):
+    def test_import_sanity(self):
+        """Test that the act of importing orange does not change
+        the global seed state.
+         
+        """
+        
+        # Needs to be tested in a clean python environment
+        import subprocess
+        import sys
+        rval = subprocess.call([sys.executable, "-c", 
+"import random; state = random.getstate(); import Orange; assert(state == random.getstate())"
+])
+        self.assertEqual(rval, 0, "'import Orange' changes the global random seed")
+
+if __name__ == "__main__":
+    unittest.main()