Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nonav option to skip navigation bar in multipage HTML #78

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

r0ckarong
Copy link
Contributor

@r0ckarong r0ckarong commented Apr 18, 2023

I need to generate standalone HTML files for my use case. The multipage option will generate separate files but includes the navigation bar to tie into the larger document. Add an option to omit this navigation bar.

@r0ckarong
Copy link
Contributor Author

I'm still trying to understand how to add a test for this.

@RobvanderMost-TomTom
Copy link
Collaborator

RobvanderMost-TomTom commented Apr 18, 2023

Ah, nice idea. Thank you for the pull request.

Maybe these tests can help you create a test for it? https://github.com/tomtom-international/asciidoxy/blob/master/tests/unit/generator/test_generator.py#L1362

I noticed I could not find an explicit test that checks. But the test mentioned above implicitly includes a check for the exact contents of the generated adoc file including the nav bar.

For writing those tests (and updating expected results) it is also good to know about this option: https://github.com/tomtom-international/asciidoxy/blob/master/tests/unit/conftest.py#L38

@r0ckarong
Copy link
Contributor Author

Ah, nice idea. Thank you for the pull request.

Maybe these tests can help you create a test for it? https://github.com/tomtom-international/asciidoxy/blob/master/tests/unit/generator/test_generator.py#L1362

I noticed I could not find an explicit test that checks. But the test mentioned above implicitly includes a check for the exact contents of the generated adoc file including the nav bar.

For writing those tests (and updating expected results) it is also good to know about this option: https://github.com/tomtom-international/asciidoxy/blob/master/tests/unit/conftest.py#L38

I'm not very firm in Python yet and need some more time to understand the tests. I'll update this PR once I've got something if that's ok.

@r0ckarong
Copy link
Contributor Author

I looked at this again but I can't crack the tests. I'm trying to understand how they are written and wanted to focus on the multipage test and try modifying it.

I checked out the latest version of master, installed the dev-requirements.txt into a venv and ran pytest to lots of errors. When I try to run the multipage test by itself (pytest -k test_process_adoc_multi_file ) I get ValueError: no option named 'update_expected_results'.

What am I missing here? Shouldn't these just pass when I clone the repo or do I need to do more?

``` (venv) C:\Users\mnapp\mydata\software\git\asciidoxy [nonav-option ≡]> pytest -k test_process_adoc_multi_file ====================================================== test session starts ======================================================= platform win32 -- Python 3.10.7, pytest-7.4.0, pluggy-1.3.0 rootdir: C:\Users\mnapp\mydata\software\git\asciidoxy configfile: pyproject.toml collected 6557 items / 6547 deselected / 10 selected

tests\unit\generator\test_generator.py EEEEEEEEEE [100%]

============================================================= ERRORS =============================================================
_______________________________ ERROR at setup of test_process_adoc_multi_file[multi-page-1.8.17] ________________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[multi-page-1.8.17]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
_______________________________ ERROR at setup of test_process_adoc_multi_file[multi-page-1.8.18] ________________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[multi-page-1.8.18]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
_______________________________ ERROR at setup of test_process_adoc_multi_file[multi-page-1.8.20] ________________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[multi-page-1.8.20]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
________________________________ ERROR at setup of test_process_adoc_multi_file[multi-page-1.9.1] ________________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[multi-page-1.9.1]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
________________________________ ERROR at setup of test_process_adoc_multi_file[multi-page-1.9.2] ________________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[multi-page-1.9.2]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
------------------------------------------------------- Captured log setup -------------------------------------------------------
ERROR asciidoxy.parser.doxygen.driver:driver.py:109 File C:\Users\mnapp\mydata\software\git\asciidoxy\tests\data\generated\xml\1.9.2\cpp\default\xml\Doxyfile.xml does not contain valid Doxygen XML.
ERROR asciidoxy.parser.doxygen.driver:driver.py:109 File C:\Users\mnapp\mydata\software\git\asciidoxy\tests\data\generated\xml\1.9.2\java\default\xml\Doxyfile.xml does not contain valid Doxygen XML.
ERROR asciidoxy.parser.doxygen.driver:driver.py:109 File C:\Users\mnapp\mydata\software\git\asciidoxy\tests\data\generated\xml\1.9.2\objc\default\xml\Doxyfile.xml does not contain valid Doxygen XML.
ERROR asciidoxy.parser.doxygen.driver:driver.py:109 File C:\Users\mnapp\mydata\software\git\asciidoxy\tests\data\generated\xml\1.9.2\python\default\xml\Doxyfile.xml does not contain valid Doxygen XML.
_______________________________ ERROR at setup of test_process_adoc_multi_file[single-page-1.8.17] _______________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[single-page-1.8.17]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
_______________________________ ERROR at setup of test_process_adoc_multi_file[single-page-1.8.18] _______________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[single-page-1.8.18]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
_______________________________ ERROR at setup of test_process_adoc_multi_file[single-page-1.8.20] _______________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[single-page-1.8.20]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
_______________________________ ERROR at setup of test_process_adoc_multi_file[single-page-1.9.1] ________________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[single-page-1.9.1]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
_______________________________ ERROR at setup of test_process_adoc_multi_file[single-page-1.9.2] ________________________________

self = <_pytest.config.Config object at 0x000002C1E7A58880>, name = 'update_expected_results', default = , skip = False

def getoption(self, name: str, default=notset, skip: bool = False):
    """Return command line option value.

    :param name: Name of the option.  You may also specify
        the literal ``--OPT`` option instead of the "dest" option name.
    :param default: Default value if no option of that name exists.
    :param skip: If True, raise pytest.skip if option does not exists
        or has a None value.
    """
    name = self._opt2dest.get(name, name)
    try:
      val = getattr(self.option, name)

E AttributeError: 'Namespace' object has no attribute 'update_expected_results'

c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1611: AttributeError

The above exception was the direct cause of the following exception:

request = <SubRequest 'update_expected_results' for <Function test_process_adoc_multi_file[single-page-1.9.2]>>

@pytest.fixture
def update_expected_results(request):
  return request.config.getoption("update_expected_results")

E ValueError: no option named 'update_expected_results'

tests\unit\conftest.py:45: ValueError
------------------------------------------------------- Captured log setup -------------------------------------------------------
ERROR asciidoxy.parser.doxygen.driver:driver.py:109 File C:\Users\mnapp\mydata\software\git\asciidoxy\tests\data\generated\xml\1.9.2\cpp\default\xml\Doxyfile.xml does not contain valid Doxygen XML.
ERROR asciidoxy.parser.doxygen.driver:driver.py:109 File C:\Users\mnapp\mydata\software\git\asciidoxy\tests\data\generated\xml\1.9.2\java\default\xml\Doxyfile.xml does not contain valid Doxygen XML.
ERROR asciidoxy.parser.doxygen.driver:driver.py:109 File C:\Users\mnapp\mydata\software\git\asciidoxy\tests\data\generated\xml\1.9.2\objc\default\xml\Doxyfile.xml does not contain valid Doxygen XML.
ERROR asciidoxy.parser.doxygen.driver:driver.py:109 File C:\Users\mnapp\mydata\software\git\asciidoxy\tests\data\generated\xml\1.9.2\python\default\xml\Doxyfile.xml does not contain valid Doxygen XML.
======================================================== warnings summary ========================================================
............\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1373
c:\BuildTools\python\3.10.7\lib\site-packages_pytest\config_init_.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode

self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================================== short test summary info =====================================================
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[multi-page-1.8.17] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[multi-page-1.8.18] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[multi-page-1.8.20] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[multi-page-1.9.1] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[multi-page-1.9.2] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[single-page-1.8.17] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[single-page-1.8.18] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[single-page-1.8.20] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[single-page-1.9.1] - ValueError: no option named 'update_expected_results'
ERROR tests/unit/generator/test_generator.py::test_process_adoc_multi_file[single-page-1.9.2] - ValueError: no option named 'update_expected_results'
========================================= 6547 deselected, 1 warning, 10 errors in 5.07s =========================================

<details>

@silvester747
Copy link
Collaborator

silvester747 commented Sep 27, 2023

I will take a look at the tests and the contributor documentation. I was actually planning to pick this up and try and create another 0.8.x release with it, but I forgot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants