e413b037182d131100ad48ec157f155943f4a4db,pyemma/coordinates/tests/test_assign.py,TestClusterAssign,test_threads_omp_env_arg_borked,#TestClusterAssign#,219

Before Change


    def test_threads_omp_env_arg_borked(self):
        import os
        os.environ["OMP_NUM_THREADS"] = "this is not right"
        try:
            import psutil
            X = np.random.random((1000, 3))
            centers = X[np.random.choice(1000, 10)]
            // note: we want another job number here, but it will be ignored!
            res = coor.assign_to_centers(X, centers, n_jobs=None, return_dtrajs=False)
            self.assertEqual(res.n_jobs, psutil.cpu_count())
        finally:
            del os.environ["OMP_NUM_THREADS"]

    def test_threads_cpu_count_def_arg(self):
        import psutil
        X = np.random.random((1000, 3))
        centers = X[np.random.choice(1000, 10)]

After Change


    def test_threads_omp_env_arg_borked(self):
         if the env var can not be interpreted as int, fall back to one thread. 
        expected = 3
        with patch("psutil.cpu_count", lambda: expected), temporary_env("OMP_NUM_THREADS", "this is not right"):
            res = coor.assign_to_centers(self.X, self.centers_big, n_jobs=None, return_dtrajs=False)
            self.assertEqual(res.n_jobs, expected)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: markovmodel/PyEMMA
Commit Name: e413b037182d131100ad48ec157f155943f4a4db
Time: 2016-11-18
Author: m.scherer@fu-berlin.de
File Name: pyemma/coordinates/tests/test_assign.py
Class Name: TestClusterAssign
Method Name: test_threads_omp_env_arg_borked


Project Name: markovmodel/PyEMMA
Commit Name: e413b037182d131100ad48ec157f155943f4a4db
Time: 2016-11-18
Author: m.scherer@fu-berlin.de
File Name: pyemma/coordinates/tests/test_assign.py
Class Name: TestClusterAssign
Method Name: test_threads_env_num_threads_fixed_def_arg


Project Name: markovmodel/PyEMMA
Commit Name: e413b037182d131100ad48ec157f155943f4a4db
Time: 2016-11-18
Author: m.scherer@fu-berlin.de
File Name: pyemma/coordinates/tests/test_assign.py
Class Name: TestClusterAssign
Method Name: test_threads_env_num_threads_fixed


Project Name: markovmodel/PyEMMA
Commit Name: e413b037182d131100ad48ec157f155943f4a4db
Time: 2016-11-18
Author: m.scherer@fu-berlin.de
File Name: pyemma/coordinates/tests/test_assign.py
Class Name: TestClusterAssign
Method Name: test_threads_omp_env_arg_borked