Skip to content

Commit

Permalink
Test that we can output a valid test directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryneeverett committed Aug 5, 2020
1 parent 7faa45d commit a0d4aac
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tests/data/nest/less/why.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# why?

Tests need to work even when the same filename is in multiple directories.

```py
import unittest

class TestLess(unittest.TestCase):
def test_less(self):
self.assertTrue(True)
```
6 changes: 5 additions & 1 deletion tests/data/nest/more/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
We want to make sure that in more complext documentation structures, which may have multiple sub directories, we are still formatting name and paths correctly.

```py
print("oh that makes sense")
import unittest

class TestMore(unittest.TestCase):
def test_more(self):
self.assertTrue(True)
```

Good.
9 changes: 9 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import shutil
import textwrap
import unittest
import subprocess

import click.testing

Expand Down Expand Up @@ -130,6 +131,14 @@ def test_prefixed_deep_blocks(self):
self.assertTrue(self._output_path_exists('test_other.py'))
self.assertTrue(self._output_path_exists('nest/test_deep.py'))
self.assertTrue(self._output_path_exists('nest/more/test_why.py'))
self.assertTrue(self._output_path_exists('nest/less/test_why.py'))

# Check that mkcodes can actually output a valid test directory.
proc = subprocess.run(
['python3', '-m', 'unittest', 'discover', 'tests/output'],
capture_output=True, text=True)
self.assertIn('Ran 2 tests', proc.stderr)
self.assertIn('OK', proc.stderr)

@unittest.skip
def test_glob(self):
Expand Down

0 comments on commit a0d4aac

Please sign in to comment.