Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/resources/significantly_different_test.py

Issue 2158413003: Parameters to significantly_different.py need to be parsed as lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Addressing feedback. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/resources/significantly_different.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 """Tests for significantly_different.""" 2 """Tests for significantly_different."""
3 3
4 import json
4 import os 5 import os
5 import sys 6 import sys
6 import unittest 7 import unittest
7 8
8 # pylint: disable=relative-import 9 # pylint: disable=relative-import
9 import significantly_different 10 import significantly_different
10 11
11 12
12 class SignificantlyDifferentTest(unittest.TestCase): 13 class SignificantlyDifferentTest(unittest.TestCase):
13 14
14 def setUp(self): 15 def setUp(self):
15 self.conda_path = None 16 self.conda_path = None
16 try: 17 try:
17 import scipy # pylint: disable=unused-variable 18 import scipy # pylint: disable=unused-variable
18 self.conda_path = sys.executable 19 self.conda_path = sys.executable
19 except ImportError: 20 except ImportError:
20 if os.path.exists(os.path.expanduser('~/conda-test/bin/python')): 21 if os.path.exists(os.path.expanduser('~/conda-test/bin/python')):
21 self.conda_path = os.path.expanduser('~/conda-test/bin/python') 22 self.conda_path = os.path.expanduser('~/conda-test/bin/python')
22 23
23 def test_basic_case(self): 24 def test_basic_case(self):
24 try: 25 try:
26 sample_A = [1, 2, 3, 3, 2, 1]
27 sample_B = [1, 2, 2, 2, 5, 0]
25 results = significantly_different.main( 28 results = significantly_different.main(
26 ['', '[1, 2, 3, 3, 2, 1]', '[1, 2, 2, 2, 5, 0]', '0.05'], 29 ['', json.dumps(sample_A), json.dumps(sample_B), '0.05'],
27 self.conda_path) 30 self.conda_path)
28 except significantly_different.ScipyNotInstalledError: 31 except significantly_different.ScipyNotInstalledError:
29 # This is meant to let presubmit pass on CQ bots :( because they don't 32 # This is meant to let presubmit pass on CQ bots :( because they don't
30 # have scipy either directly or thorugh anaconda. 33 # have scipy either directly or thorugh anaconda.
31 return 34 return
32 35
33 self.assertAlmostEqual( 36 self.assertAlmostEqual(
34 0.40073980338363635, 37 0.40073980338363635,
35 results['mann_p_value']) 38 results['mann_p_value'])
39 self.assertEqual(results['first_sample'], sample_A)
40 self.assertEqual(results['second_sample'], sample_B)
41
42 def test_single_value(self):
43 try:
44 sample_A = [1, 1, 1, 1, 1, 1]
45 sample_B = [1, 1, 1]
46 results = significantly_different.main(
47 ['', json.dumps(sample_A), json.dumps(sample_B), '0.05'],
48 self.conda_path)
49 except significantly_different.ScipyNotInstalledError:
50 # This is meant to let presubmit pass on CQ bots :( because they don't
51 # have scipy either directly or thorugh anaconda.
52 return
53 self.assertIsNone(results['mann_p_value'])
54 self.assertFalse(results['significantly_different'])
55 self.assertEqual(results['first_sample'], sample_A)
56 self.assertEqual(results['second_sample'], sample_B)
36 57
37 if __name__ == '__main__': 58 if __name__ == '__main__':
38 unittest.main() 59 unittest.main()
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/resources/significantly_different.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698