diff --git a/Makefile b/Makefile index 5a887a7..a2ea19d 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,10 @@ clean: find . -name "*.so" -o -name "*.pyc" -o -name "*.pyx.md5" | xargs rm -f coverage: - nosetests code/stat159lambda/utils data --with-coverage --cover-package=data --cover-package=utils + nosetests code/stat159lambda/ data --with-coverage test: - nosetests code/stat159lambda/utils data + nosetests code/stat159lambda/ data verbose: - nosetests -v code/stat159lambda/utils data + nosetests -v code/stat159lambda/ data diff --git a/code/stat159lambda/classification/tests/test_rf.py b/code/stat159lambda/classification/tests/test_rf.py index fcacd71..6fccc52 100644 --- a/code/stat159lambda/classification/tests/test_rf.py +++ b/code/stat159lambda/classification/tests/test_rf.py @@ -1,4 +1,4 @@ -from stat159lambda.classification import rf +from stat159lambda.classification.random_forest import rf import numpy as np from sklearn.ensemble import RandomForestClassifier try: @@ -13,12 +13,6 @@ def test_prepare(): y = np.array([1, 0, 1, 1, 0, 2, 1, 1, 0, 0]) return X, y - -def test_cv_rf_accuracy(): - X, y = test_prepare() - assert rf.cv_rf_accuracy(X, y, 2, 2, 2, num_folds=5) > 0 - - # @patch.object(RandomForestClassifier, '__init__') # def test_rf_accuracy(mock_rf_init): # X, y = test_prepare() diff --git a/code/stat159lambda/simulations/correlation_simulation.py b/code/stat159lambda/simulations/correlation_simulation.py index 49b4180..7468b46 100644 --- a/code/stat159lambda/simulations/correlation_simulation.py +++ b/code/stat159lambda/simulations/correlation_simulation.py @@ -1,5 +1,7 @@ import numpy as np from scipy import stats +import matplotlib +matplotlib.use('Agg') import matplotlib.pyplot as plt from stat159lambda.config import REPO_HOME_PATH diff --git a/code/stat159lambda/simulations/tests/__init__.py b/code/stat159lambda/simulations/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/code/stat159lambda/simulations/tests/test_correlation_simulation.py b/code/stat159lambda/simulations/tests/test_correlation_simulation.py index 68eb47a..b018147 100644 --- a/code/stat159lambda/simulations/tests/test_correlation_simulation.py +++ b/code/stat159lambda/simulations/tests/test_correlation_simulation.py @@ -3,6 +3,8 @@ from stat159lambda.config import REPO_HOME_PATH import matplotlib +matplotlib.use('Agg') +import matplotlib.pyplot as plt from numpy.testing import assert_array_equal import unittest import imp @@ -14,11 +16,12 @@ class SimulateInterRunCorrelationTestCases(unittest.TestCase): - @patch.object(matplotlib.pyplot, 'savefig') + @patch.object(plt, 'savefig') def test_simulate_inter_run_correlation(self, mock_savefig): correlation_simulation.simulate_inter_run_correlation() assert_array_equal( mock_savefig.call_args[0][0], '{0}/figures/sim_inter_run.png'.format(REPO_HOME_PATH)) - main_module = imp.load_source('__main__', '../correlation_simulation.py'.format(REPO_HOME_PATH)) + correlation_simulation_path = '{0}/code/stat159lambda/simulations/correlation_simulation.py'.format(REPO_HOME_PATH) + main_module = imp.load_source('__main__', correlation_simulation_path) self.assertEqual(main_module.__name__, '__main__')