Skip to content

Commit

Permalink
Merge pull request #622 from niccokunzmann/docs-error
Browse files Browse the repository at this point in the history
Guide to delete the build folder before testing
  • Loading branch information
niccokunzmann committed Jun 17, 2024
2 parents 4484608 + 4b5cb00 commit e7ec88d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog

Minor changes:

- Guide to delete the build folder before running tests
- Add funding information
- Make documentation build with Python 3.12
- Update windows to olson conversion for Greenland Standard Time
Expand Down
20 changes: 10 additions & 10 deletions src/icalendar/tests/test_with_doctest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This file tests the source code provided by the documentation.
See
See
- doctest documentation: https://docs.python.org/3/library/doctest.html
- Issue 443: https://github.com/collective/icalendar/issues/443
Expand Down Expand Up @@ -43,12 +43,15 @@ def test_docstring_of_python_file(module_name):
# This collection needs to exclude .tox and other subdirectories
DOCUMENTATION_PATH = os.path.join(HERE, "../../../")

DOCUMENT_PATHS = [
os.path.join(DOCUMENTATION_PATH, subdir, filename)
for subdir in ["docs", "."]
for filename in os.listdir(os.path.join(DOCUMENTATION_PATH, subdir))
if filename.lower().endswith(".rst")
]
try:
DOCUMENT_PATHS = [
os.path.join(DOCUMENTATION_PATH, subdir, filename)
for subdir in ["docs", "."]
for filename in os.listdir(os.path.join(DOCUMENTATION_PATH, subdir))
if filename.lower().endswith(".rst")
]
except FileNotFoundError:
raise EnvironmentError("Could not find the documentation - remove the build folder and try again.")

@pytest.mark.parametrize("filename", [
"README.rst",
Expand All @@ -62,6 +65,3 @@ def test_documentation_file(document):
"""This test runs doctest on a documentation file."""
test_result = doctest.testfile(document, module_relative=False)
assert test_result.failed == 0, f"{test_result.failed} errors in {os.path.basename(document)}"



0 comments on commit e7ec88d

Please sign in to comment.