root/branches/mk/tests/unit/test_count_files.py

Revision 55, 1.4 kB (checked in by mk, 6 years ago)

Created functional tests directory and moved all existing unit tests to separate directory.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2 import _path_cheesecake
3 from cheesecake.cheesecake_index import get_files_of_type
4
5 from _mockup_cheesecake import MockupCheesecakeTest
6 from _helper_cheesecake import set
7
8
9 class TestNoTestFiles(MockupCheesecakeTest):
10     def test_discover_no_test_files(self):
11         py_files = ['main.py', 'module.py']
12         self.create_files(self.prefix_with_package_name(py_files))
13         self.cheesecake.walk_pkg()
14         self.cheesecake.compute_cheesecake_index()
15
16         def get_list(type):
17             return get_files_of_type(self.cheesecake.files_list, type)
18
19         assert set(get_list('module')) == set(py_files)
20         assert get_list('pyc') == []
21         assert get_list('pyo') == []
22         assert get_list('test') == []
23
24
25 class TestPycPyoFiles(MockupCheesecakeTest):
26     def test_some_pyc_and_pyo_files(self):
27         py_files = ['main.py']
28         pyc_files = ['main.pyc', 'missing.pyc']
29         pyo_files = ['main.pyo', 'optimised.pyo']
30
31         self.create_files(self.prefix_with_package_name(py_files + pyc_files + pyo_files))
32         self.cheesecake.walk_pkg()
33         self.cheesecake.compute_cheesecake_index()
34
35         def get_list(type):
36             return get_files_of_type(self.cheesecake.files_list, type)
37
38         assert set(get_list('module')) == set(py_files)
39         assert set(get_list('pyc')) == set(pyc_files)
40         assert set(get_list('pyo')) == set(pyo_files)
41         assert get_list('test') == []
Note: See TracBrowser for help on using the browser.