Skip to content

Commit

Permalink
Merge pull request #622 from neerdoc/fixes_toward_3.0
Browse files Browse the repository at this point in the history
Rework of HTML publisher.
  • Loading branch information
neerdoc committed Jan 26, 2024
2 parents f34c454 + aabbe88 commit 4326c38
Show file tree
Hide file tree
Showing 91 changed files with 2,529 additions and 1,497 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ exclude_lines =
pragma: no cover
raise NotImplementedError
except DistributionNotFound
if __name__ == '__main__'

skip_covered = true
12 changes: 1 addition & 11 deletions .github/workflows/execute-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,8 @@ jobs:
with:
command: make test
current_path: ${{ inputs.workpath }}
attempt_limit: 3
attempt_limit: 5
attempt_delay: 2000

# - name: Run tests attempt 1
# run: make test
# - name: Run tests attempt 2
# if: ${{ failure() }}
# run: make test
# - name: Run tests attempt 3
# if: ${{ failure() }}
# run: make test

- name: Upload coverage
uses: codecov/codecov-action@v1
if: ${{ inputs.os == 'ubuntu-latest' && matrix.python-version == '3.9' && github.repository == 'doorstop-dev/doorstop' }}
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
python 3.8.13
poetry 1.6.1
poetry 1.7.1
4 changes: 2 additions & 2 deletions .verchew.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ version = 3.8 || 3.9 || 3.10 || 3.11 || 3.12
[Poetry]

cli = poetry
version = 1
version = 1.7

[Graphviz]

cli = dot
cli_version_arg = -V
version = 7
version = 9
optional = true
message = This is only needed to generate UML diagrams for documentation.
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ Clean everything:
$ make clean
```

Compare coverage to current `develop` branch to see if changes causes reduced coverage.
Please run before creating a PR.
```sh
$ make test-cover
```

## Automatic

Keep all of the above tasks running on change:
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ ifndef DISABLE_COVERAGE
poetry run coveragespace update overall
endif

.PHONY: test-cover
test-cover: install
# Run first to generate coverage data current code.
TEST_INTEGRATION=true poetry run pytest doorstop --doctest-modules --cov=doorstop --cov-report=xml --cov-report=term-missing
# Run second to generate coverage data for the code in the develop branch.
TEST_INTEGRATION=true diff-cover ./coverage.xml --compare-branch=$(shell git for-each-ref --sort=-committerdate refs/heads/develop | cut -f 1 -d ' ')

.PHONY: read-coverage
read-coverage:
bin/open htmlcov/index.html
Expand Down
6 changes: 3 additions & 3 deletions doorstop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""Package for doorstop."""

from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import PackageNotFoundError, version

from doorstop.common import DoorstopError, DoorstopInfo, DoorstopWarning
from doorstop.core import (
Expand All @@ -22,8 +22,8 @@
__project__ = "Doorstop"

try:
__version__ = get_distribution(__project__).version
except DistributionNotFound:
__version__ = version(__project__)
except PackageNotFoundError:
__version__ = "(local)"

CLI = "doorstop"
Expand Down
7 changes: 2 additions & 5 deletions doorstop/cli/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,15 +782,12 @@ def test_publish_document_markdown_file(self):
self.assertIs(None, main(["publish", "req", path]))
self.assertTrue(os.path.isfile(path))

def test_publish_document_html(self):
"""Verify 'doorstop publish' can create HTML output."""
self.assertIs(None, main(["publish", "hlt", "--html"]))

def test_publish_document_html_file(self):
"""Verify 'doorstop publish' can create an HTML file."""
path = os.path.join(self.temp, "req.html")
self.assertIs(None, main(["publish", "req", path]))
self.assertTrue(os.path.isfile(path))
filePath = os.path.join(self.temp, "documents", "req.html")
self.assertTrue(os.path.isfile(filePath))

def test_publish_tree_html(self):
"""Verify 'doorstop publish' can create an HTML directory."""
Expand Down
12 changes: 12 additions & 0 deletions doorstop/cli/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

"""Unit tests for the doorstop.cli.main module."""

import importlib.util
import sys
from os import sep
from unittest.mock import Mock, patch

from doorstop import settings
Expand Down Expand Up @@ -72,3 +75,12 @@ def test_options(self):
self.assertFalse(settings.CACHE_PATHS)
self.assertTrue(settings.WARN_ALL)
self.assertTrue(settings.ERROR_ALL)

def test_main(self):
testargs = [sep.join(["doorstop", "cli", "main.py"])]
with patch.object(sys, "argv", testargs):
spec = importlib.util.spec_from_file_location("__main__", testargs[0])
runpy = importlib.util.module_from_spec(spec)
spec.loader.exec_module(runpy)
# Assert
self.assertIsNotNone(runpy)
118 changes: 0 additions & 118 deletions doorstop/core/files/templates/doorstop.css

This file was deleted.

7 changes: 7 additions & 0 deletions doorstop/core/files/templates/html/bootstrap.bundle.min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions doorstop/core/files/templates/html/bootstrap.min.css

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions doorstop/core/files/templates/html/bootstrap.min.js

This file was deleted.

7 changes: 7 additions & 0 deletions doorstop/core/files/templates/html/doorstop.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Doorstop.css file. */
.caption {
text-align: center;
font-size:15px;
}

#img {width: 100%}
6 changes: 3 additions & 3 deletions doorstop/core/files/templates/html/general.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
body {
padding-left: 20px;
padding-top: 20px;
padding-right: 20px;
padding-left: 0px;
padding-top: 0px;
padding-right: 0px;
}

/* indent everything within a section */
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doorstop/core/files/templates/html/output/chtml.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions doorstop/core/files/templates/html/output/svg.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doorstop/core/files/templates/html/output/svg/fonts/tex.js

Large diffs are not rendered by default.

71 changes: 0 additions & 71 deletions doorstop/core/files/templates/html/sidebar.css

This file was deleted.

1 change: 1 addition & 0 deletions doorstop/core/files/templates/html/tex-mml-chtml.js

Large diffs are not rendered by default.

0 comments on commit 4326c38

Please sign in to comment.