| 1 |
|
|---|
| 2 |
from _mockup_cheesecake import MockupCheesecakeTest |
|---|
| 3 |
|
|---|
| 4 |
if 'set' not in dir(__builtins__): |
|---|
| 5 |
from sets import Set as set |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
class TestNoTestFiles(MockupCheesecakeTest): |
|---|
| 9 |
def test_discover_no_test_files(self): |
|---|
| 10 |
py_files = self.prefix_with_package_name(['main.py', 'module.py']) |
|---|
| 11 |
self.create_files(py_files) |
|---|
| 12 |
self.cheesecake.walk_pkg() |
|---|
| 13 |
|
|---|
| 14 |
assert set(self.cheesecake.pkg_files['py']) == set(py_files) |
|---|
| 15 |
assert self.cheesecake.pkg_files['pyc'] == [] |
|---|
| 16 |
assert self.cheesecake.pkg_files['pyo'] == [] |
|---|
| 17 |
assert self.cheesecake.pkg_files['test'] == [] |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
class TestPycPyoFiles(MockupCheesecakeTest): |
|---|
| 21 |
def test_some_pyc_and_pyo_files(self): |
|---|
| 22 |
py_files = self.prefix_with_package_name(['main.py']) |
|---|
| 23 |
pyc_files = self.prefix_with_package_name(['main.pyc', 'missing.pyc']) |
|---|
| 24 |
pyo_files = self.prefix_with_package_name(['main.pyo', 'optimised.pyo']) |
|---|
| 25 |
|
|---|
| 26 |
self.create_files(py_files + pyc_files + pyo_files) |
|---|
| 27 |
self.cheesecake.walk_pkg() |
|---|
| 28 |
|
|---|
| 29 |
assert set(self.cheesecake.pkg_files['py']) == set(py_files) |
|---|
| 30 |
assert set(self.cheesecake.pkg_files['pyc']) == set(pyc_files) |
|---|
| 31 |
assert set(self.cheesecake.pkg_files['pyo']) == set(pyo_files) |
|---|
| 32 |
assert self.cheesecake.pkg_files['test'] == [] |
|---|