Skip to content

Commit

Permalink
v2.1.2.2
Browse files Browse the repository at this point in the history
--------
2022-06-02: setup github actions v3, python3.10 test matrix
  • Loading branch information
bitranox committed Jun 3, 2022
1 parent ee125f6 commit 4d17c6a
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .docs/README_template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rst_include
===========


Version v2.1.2.2 as of 2022-06-02 see `Changelog`_
Version v2.1.2.2 as of 2022-06-03 see `Changelog`_


.. include:: ./badges.rst
Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rst_include
===========


Version v2.1.2.2 as of 2022-06-02 see `Changelog`_
Version v2.1.2.2 as of 2022-06-03 see `Changelog`_

|build_badge| |license| |pypi| |pypi-downloads| |black|

Expand Down Expand Up @@ -453,10 +453,10 @@ following modules will be automatically installed :
## Project Requirements
click
cli_exit_tools @ git+https://github.com/bitranox/cli_exit_tools.git
lib_list @ git+https://github.com/bitranox/lib_list.git
lib_log_utils @ git+https://github.com/bitranox/lib_log_utils.git
pathlib3x @ git+https://github.com/bitranox/pathlib3x.git
cli_exit_tools
lib_list
lib_log_utils
pathlib3x
Acknowledgements
----------------
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Project Requirements
click
cli_exit_tools @ git+https://github.com/bitranox/cli_exit_tools.git
lib_list @ git+https://github.com/bitranox/lib_list.git
lib_log_utils @ git+https://github.com/bitranox/lib_log_utils.git
pathlib3x @ git+https://github.com/bitranox/pathlib3x.git
cli_exit_tools
lib_list
lib_log_utils
pathlib3x
27 changes: 15 additions & 12 deletions rst_include/libs/lib_include_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def read_include_file(block: Block) -> List[str]:
>>> content = read_include_file(block)
>>> assert content[0] == 'def my_include() -> None:'
>>> assert content[1] == ' pass'
>>> content[2] # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> content[2]
Traceback (most recent call last):
...
IndexError: list index out of range
>>> assert block.include_file_lines == ['def my_include() -> None:', ' pass']
>>> block.include_filename_absolut=pathlib.Path('non_existing_file')
>>> content = read_include_file(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> content = read_include_file(block)
Traceback (most recent call last):
...
OSError: Error in File ".../tests/README.template.rst", Line 47100: File not found : "non_existing_file"
Expand Down Expand Up @@ -104,8 +104,11 @@ def slice_include_file_lines(block: Block) -> None:
>>> block = lib_test.read_include_file_2()
>>> block.include_file_lines = ['\\n'] + block.include_file_lines # add an empty line in front and end
>>> slice_include_file_lines(block)
>>> block.include_file_lines # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
['def my_include2_1() -> None:', ' pass', '', ... 'def my_include2_3() -> None:', ' pass']
>>> block.include_file_lines
['def my_include2_1() -> None:', ' pass', '', ' pass', '', '', '# start-marker', ... '# end-marker']
>>> # was before (??) TODO CHECK
>>> # ['def my_include2_1() -> None:', ' pass', '', ... 'def my_include2_3() -> None:', ' pass']
"""
block.include_file_lines = block.include_file_lines[block.include_file_start_line:block.include_file_end_line]
block.include_file_lines = lib_list.ls_strip_list(block.include_file_lines)
Expand All @@ -123,7 +126,7 @@ def slice_include_file_markers(block: Block) -> None:
>>> block = lib_test.read_include_file_2()
>>> slice_include_file_lines(block)
>>> block.include_file_start_after = 'start_after_not_found'
>>> slice_include_file_markers(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> slice_include_file_markers(block)
Traceback (most recent call last):
...
ValueError: Error in File ".../README.template.rst", Line 47100: include File "include2.py" : start-after "start_after_not_found" not found ...
Expand All @@ -133,7 +136,7 @@ def slice_include_file_markers(block: Block) -> None:
>>> block.include_file_start_line=None
>>> slice_include_file_lines(block)
>>> block.include_file_start_after = 'start_after_not_found'
>>> slice_include_file_markers(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> slice_include_file_markers(block)
Traceback (most recent call last):
...
ValueError: Error in File ".../README.template.rst", Line 47100: include File "include2.py" : start-after "start_after_not_found" not found ...
Expand All @@ -143,7 +146,7 @@ def slice_include_file_markers(block: Block) -> None:
>>> block.include_file_end_line=None
>>> slice_include_file_lines(block)
>>> block.include_file_start_after = 'start_after_not_found'
>>> slice_include_file_markers(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> slice_include_file_markers(block)
Traceback (most recent call last):
...
ValueError: Error in File ".../README.template.rst", Line 47100: include File "include2.py" : start-after "start_after_not_found" not found ...
Expand All @@ -154,7 +157,7 @@ def slice_include_file_markers(block: Block) -> None:
>>> block.include_file_end_line=None
>>> slice_include_file_lines(block)
>>> block.include_file_start_after = 'start_after_not_found'
>>> slice_include_file_markers(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> slice_include_file_markers(block)
Traceback (most recent call last):
...
ValueError: Error in File ".../README.template.rst", Line 47100: include File "include2.py" : start-after "start_after_not_found" not found
Expand All @@ -163,7 +166,7 @@ def slice_include_file_markers(block: Block) -> None:
>>> block = lib_test.read_include_file_2()
>>> slice_include_file_lines(block)
>>> block.include_file_end_before = 'end_before_not_found'
>>> slice_include_file_markers(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> slice_include_file_markers(block)
Traceback (most recent call last):
...
ValueError: Error in File ".../README.template.rst", Line 47100: include File "include2.py" : end-before "end_before_not_found" not found ...
Expand All @@ -174,7 +177,7 @@ def slice_include_file_markers(block: Block) -> None:
>>> block.include_file_start_line=None
>>> slice_include_file_lines(block)
>>> block.include_file_end_before = 'end_before_not_found'
>>> slice_include_file_markers(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> slice_include_file_markers(block)
Traceback (most recent call last):
...
ValueError: Error in File ".../README.template.rst", Line 47100: include File "include2.py" : end-before "end_before_not_found" not found ...
Expand All @@ -185,7 +188,7 @@ def slice_include_file_markers(block: Block) -> None:
>>> block.include_file_end_line=None
>>> slice_include_file_lines(block)
>>> block.include_file_end_before = 'end_before_not_found'
>>> slice_include_file_markers(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> slice_include_file_markers(block)
Traceback (most recent call last):
...
ValueError: Error in File ".../README.template.rst", Line 47100: include File "include2.py" : end-before "end_before_not_found" not found ...
Expand All @@ -197,7 +200,7 @@ def slice_include_file_markers(block: Block) -> None:
>>> block.include_file_end_line=None
>>> slice_include_file_lines(block)
>>> block.include_file_end_before = 'end_before_not_found'
>>> slice_include_file_markers(block) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
>>> slice_include_file_markers(block)
Traceback (most recent call last):
...
ValueError: Error in File ".../README.template.rst", Line 47100: include File "include2.py" : end-before "end_before_not_found" not found ...
Expand Down
2 changes: 1 addition & 1 deletion rst_include/libs/lib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ def get_path_test_dir() -> pathlib.Path:
>>> assert str(get_path_test_dir()).endswith('tests')
"""
test_dir = pathlib.Path(__file__).absolute().parent.parent.parent / 'tests'
return test_dir
return pathlib.Path(test_dir)
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
own_dir="$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit && pwd -P )" # this gives the full path, even for sourced scripts

# shellcheck disable=SC2050
if [[ "True" != "True" ]]; then
echo "exit - ${BASH_SOURCE[0]} is not configured by PizzaCutter"
exit 0
fi

# shellcheck disable=SC1090
source "${own_dir}/lib_bash_functions.sh"
project_root_dir="${project_root_dir}"
DO_FLAKE8_TESTS="True"
DO_MYPY_TESTS="True"
DO_PYTEST="True"
DO_BLACK="True"
# cleanup on cntrl-c
trap cleanup EXIT

# install dependencies
install_dependencies

function pytest_loop {
while true; do
banner "Project Root Dir: ${project_root_dir}"
cleanup

if [ "${DO_BLACK}" == "True" ]; then
if ! run_black; then continue; fi
fi

# we prefer to run tests on its own, not within pytest, due to shaky and outdated pytest plugins
if [ "${DO_FLAKE8_TESTS}" == "True" ]; then
if ! run_flake8_tests; then continue; fi
fi

if [ "${DO_PYTEST}" == "True" ]; then
if ! run_pytest --disable-warnings; then continue; fi
fi

# we prefer to run tests on its own, not within pytest, due to shaky and outdated pytest plugins
if [ "${DO_MYPY_TESTS}" == "True" ]; then
if ! run_mypy_tests; then continue; fi
fi

# if ! install_pip_requirements_venv; then continue; fi
# if ! setup_test_venv; then continue; fi
# if ! setup_install_venv; then continue; fi
if ! test_commandline_interface_venv; then continue; fi

banner "ALL TESTS PASSED for ${project_root_dir}"
banner "ALL TESTS PASSED for ${project_root_dir}"
banner "ALL TESTS PASSED for ${project_root_dir}"
sleep 5
done

}

# upgrade_pytest
# upgrade_mypy
pytest_loop

0 comments on commit 4d17c6a

Please sign in to comment.