Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions _doc/sphinxdoc/source/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ You can get them with:

python setup.py unittests --help

The process first calls the function :func:`_setup_hook <pyquickhelper._setup_hook>`.
It can be used to initialize the module even if it is most of the time unused.
The process ends the code coverage (with module :epkg:`coverage`)
The command line runs the unit tests.
The process ends with the code coverage (with module :epkg:`coverage`)
and publishes the report in folder `_doc/sphinxdoc/source/coverage`.
If options ``-e`` and ``-g`` are left empty, files containing `test_LONG_`,
`test_SKIP_`, `test_GUI_` in their
Expand Down
95 changes: 0 additions & 95 deletions _unittests/ut_module/test_call_setup_hook.py

This file was deleted.

13 changes: 1 addition & 12 deletions _unittests/ut_module/test_init_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from contextlib import redirect_stdout

from pyquickhelper.loghelper import fLOG
from pyquickhelper import check, _setup_hook, get_insetup_functions
from pyquickhelper import check, get_insetup_functions


class TestInitFunction(unittest.TestCase):
Expand All @@ -21,17 +21,6 @@ def test_check(self):
OutputPrint=__name__ == "__main__")
check()

def test_hook(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
_setup_hook()
buf = io.StringIO()
with redirect_stdout(buf):
_setup_hook(True)
self.assertIn('Success', buf.getvalue())

def test_insetup(self):
fLOG(
__file__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def skip_function(name, code, duration):

fLOG("unit tests", root)
for command in ["version", "write_version", "clean_pyd",
"setup_hook", "build_script", "copy27",
"build_script", "copy27",
"run_pylint .*((myex)|(example_ext)).*[.]py$ "
"-iC0103 -iR0201 -iC0123 -iC0111 -iW0611 -iE0401 -iE0611 -iE0401",
"unittests -e .*code_style.*",
Expand Down Expand Up @@ -136,7 +136,7 @@ def logging_custom(*args, **kwargs):
additional_ut_path=[pyq, (root, True)],
skip_function=skip_function,
coverage_options={"disable_coverage": True},
hook_print=False, stdout=stdout2, stderr=stderr2,
stdout=stdout2, stderr=stderr2,
use_run_cmd=True)
goon = True
except PEP8Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_pycode/test_build_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_build_script_all(self):
"build_sphinx", "unittests",
"unittests_LONG", "unittests_SKIP",
"copy27", "test_local_pypi",
"setup_hook", "unittests_GUI"):
"unittests_GUI"):
sc = get_script_command(
c, project_var_name, requirements=requirements, port=port)
self.assertTrue(len(sc) > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def logging_custom(*args, **kwargs):
pyq, (root, True)],
skip_function=skip_function, coverage_options={
"disable_coverage": True},
hook_print=False, stdout=stdout2, stderr=stderr2, use_run_cmd=True)
stdout=stdout2, stderr=stderr2, use_run_cmd=True)

vout = stdout2.getvalue()
stdout.write(vout)
Expand Down
16 changes: 0 additions & 16 deletions src/pyquickhelper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,6 @@ def check():
return True


def _setup_hook(add_print=False, unit_test=False):
"""
if this function is added to the module,
the help automation and unit tests call it first before
anything goes on as an initialization step.
It should be run in a separate process.

@param add_print print *Success: _setup_hook*
@param unit_test used only for unit testing purpose
"""
# it can check many things, needed module
# any others things before unit tests are started
if add_print:
print("Success: _setup_hook") # pragma: no cover


def load_ipython_extension(ip): # pragma: no cover
"""
to allow the call ``%load_ext pyquickhelper``
Expand Down
2 changes: 0 additions & 2 deletions src/pyquickhelper/helpgen/sphinx_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ def generate_help_sphinx(project_var_name, clean=False, root=".",
Parameters *from_repo*, *use_run_cmd* were added.
Notebook conversion to slides is implemented,
install :epkg:`reveal.js` if not installed.
Calls the function @see fn _setup_hook to initialize
the module before generating the documentation.
Parameter *add_htmlhelp* was added. It runs HtmlHelp on Windows ::

"C:\\Program Files (x86)\\HTML Help Workshop\\hhc.exe" build\\htmlhelp\\<module>.hhp
Expand Down
159 changes: 0 additions & 159 deletions src/pyquickhelper/pycode/call_setup_hook.py

This file was deleted.

7 changes: 0 additions & 7 deletions src/pyquickhelper/pycode/code_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,3 @@ class CoverageException(Exception):
raised when an issue happens with the coverage
"""
pass


class SetupHookException(Exception):
"""
raised when something happen while running setup_hook
"""
pass
Loading