new_tests.py 631 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. import tempfile
  3. import unittest
  4. import os
  5. from mkdocs.commands import new
  6. class NewTests(unittest.TestCase):
  7. def test_new(self):
  8. tempdir = tempfile.mkdtemp()
  9. os.chdir(tempdir)
  10. new.new("myproject")
  11. expected_paths = [
  12. os.path.join(tempdir, "myproject"),
  13. os.path.join(tempdir, "myproject", "mkdocs.yml"),
  14. os.path.join(tempdir, "myproject", "docs"),
  15. os.path.join(tempdir, "myproject", "docs", "index.md"),
  16. ]
  17. for expected_path in expected_paths:
  18. self.assertTrue(os.path.exists(expected_path))