|
29 | 29 | @author: Kenneth Hoste (Ghent University) |
30 | 30 | @author: Stijn De Weirdt (Ghent University) |
31 | 31 | @author: Ward Poelmans (Ghent University) |
| 32 | +@author: Maxime Boissonneault (Compute Canada, Universite Laval) |
32 | 33 | """ |
33 | 34 | import datetime |
34 | 35 | import glob |
@@ -148,6 +149,29 @@ def test_find_base_dir(self): |
148 | 149 | os.chdir(tmpdir) |
149 | 150 | self.assertTrue(os.path.samefile(foodir, ft.find_base_dir())) |
150 | 151 |
|
| 152 | + def test_find_glob_pattern(self): |
| 153 | + """test find_glob_pattern function""" |
| 154 | + tmpdir = tempfile.mkdtemp() |
| 155 | + os.mkdir(os.path.join(tmpdir, 'python2.7')) |
| 156 | + os.mkdir(os.path.join(tmpdir, 'python2.7', 'include')) |
| 157 | + os.mkdir(os.path.join(tmpdir, 'python3.5m')) |
| 158 | + os.mkdir(os.path.join(tmpdir, 'python3.5m', 'include')) |
| 159 | + |
| 160 | + self.assertEqual(ft.find_glob_pattern(os.path.join(tmpdir, 'python2.7*')), |
| 161 | + os.path.join(tmpdir, 'python2.7')) |
| 162 | + self.assertEqual(ft.find_glob_pattern(os.path.join(tmpdir, 'python2.7*', 'include')), |
| 163 | + os.path.join(tmpdir, 'python2.7', 'include')) |
| 164 | + self.assertEqual(ft.find_glob_pattern(os.path.join(tmpdir, 'python3.5*')), |
| 165 | + os.path.join(tmpdir, 'python3.5m')) |
| 166 | + self.assertEqual(ft.find_glob_pattern(os.path.join(tmpdir, 'python3.5*', 'include')), |
| 167 | + os.path.join(tmpdir, 'python3.5m', 'include')) |
| 168 | + self.assertEqual(ft.find_glob_pattern(os.path.join(tmpdir, 'python3.6*'), False), None) |
| 169 | + self.assertErrorRegex(EasyBuildError, "Was expecting exactly", ft.find_glob_pattern, |
| 170 | + os.path.join(tmpdir, 'python3.6*')) |
| 171 | + self.assertErrorRegex(EasyBuildError, "Was expecting exactly", ft.find_glob_pattern, |
| 172 | + os.path.join(tmpdir, 'python*')) |
| 173 | + |
| 174 | + |
151 | 175 | def test_encode_class_name(self): |
152 | 176 | """Test encoding of class names.""" |
153 | 177 | for (class_name, encoded_class_name) in self.class_names: |
|
0 commit comments