utilotest 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. utilotest-1.0.1/MANIFEST.in +10 -0
  2. utilotest-1.0.1/PKG-INFO +21 -0
  3. utilotest-1.0.1/README +1 -0
  4. utilotest-1.0.1/power/__init__.py +17 -0
  5. utilotest-1.0.1/pyproject.toml +81 -0
  6. utilotest-1.0.1/setup.cfg +4 -0
  7. utilotest-1.0.1/tests/test_baseline.py +41 -0
  8. utilotest-1.0.1/tests/test_call.py +18 -0
  9. utilotest-1.0.1/tests/test_file.py +38 -0
  10. utilotest-1.0.1/tests/test_install.py +64 -0
  11. utilotest-1.0.1/tests/test_log.py +57 -0
  12. utilotest-1.0.1/tests/test_requires.py +65 -0
  13. utilotest-1.0.1/tests/test_run.py +63 -0
  14. utilotest-1.0.1/tests/test_selenium.py +21 -0
  15. utilotest-1.0.1/tests/test_tracer.py +43 -0
  16. utilotest-1.0.1/tests/test_utils.py +53 -0
  17. utilotest-1.0.1/utilotest/__init__.py +99 -0
  18. utilotest-1.0.1/utilotest/baseline.py +144 -0
  19. utilotest-1.0.1/utilotest/call.py +151 -0
  20. utilotest-1.0.1/utilotest/cli/__init__.py +8 -0
  21. utilotest-1.0.1/utilotest/cli/tracer.py +62 -0
  22. utilotest-1.0.1/utilotest/config.py +16 -0
  23. utilotest-1.0.1/utilotest/file.py +87 -0
  24. utilotest-1.0.1/utilotest/install.py +49 -0
  25. utilotest-1.0.1/utilotest/log.py +58 -0
  26. utilotest-1.0.1/utilotest/runner.py +168 -0
  27. utilotest-1.0.1/utilotest/select.py +126 -0
  28. utilotest-1.0.1/utilotest/shortcuts.py +20 -0
  29. utilotest-1.0.1/utilotest/utils.py +144 -0
  30. utilotest-1.0.1/utilotest.egg-info/PKG-INFO +21 -0
  31. utilotest-1.0.1/utilotest.egg-info/SOURCES.txt +36 -0
  32. utilotest-1.0.1/utilotest.egg-info/dependency_links.txt +1 -0
  33. utilotest-1.0.1/utilotest.egg-info/entry_points.txt +2 -0
  34. utilotest-1.0.1/utilotest.egg-info/requires.txt +8 -0
  35. utilotest-1.0.1/utilotest.egg-info/top_level.txt +3 -0
  36. utilotest-1.0.1/viewvisitor/__init__.py +20 -0
  37. utilotest-1.0.1/viewvisitor/fixture.py +43 -0
  38. utilotest-1.0.1/viewvisitor/fuchs/geckodriver.exe +0 -0
@@ -0,0 +1,10 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2020-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ graft viewvisitor/fuchs
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: utilotest
3
+ Version: 1.0.1
4
+ Author-email: Helmut Konrad Schewe <helmutus@outlook.com>
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/anaticulae/utilotest
7
+ Project-URL: Repository, https://github.com/anaticulae/utilotest
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Classifier: Programming Language :: Python :: 3.14
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: utilo<3.0.0,>=2.107.0
14
+ Requires-Dist: configos<2.0.0,>=1.0.2
15
+ Requires-Dist: resinf<2.0.0,>=1.0.2
16
+ Requires-Dist: pytest<10.0.0,>=9.0.2
17
+ Provides-Extra: dev
18
+ Requires-Dist: selenium==4.41.0; extra == "dev"
19
+ Requires-Dist: pytest_localserver==0.7.0; extra == "dev"
20
+
21
+ # utilotest
utilotest-1.0.1/README ADDED
@@ -0,0 +1 @@
1
+ # utilotest
@@ -0,0 +1,17 @@
1
+ # REMOVE LATER
2
+
3
+ DOCU007_PDF = "abc/docu/docu007.pdf"
4
+ DOCU009_PDF = "abc/docu/docu009.pdf"
5
+
6
+ BACHELOR028_PDF = "abc/bachelor/bachelor028.pdf"
7
+ BACHELOR090_PDF = "abc/bachelor/bachelor090.pdf"
8
+
9
+ MASTER116_PDF = "abc/master/master116.pdf"
10
+
11
+ RESOURCES = [
12
+ DOCU007_PDF,
13
+ DOCU009_PDF,
14
+ BACHELOR028_PDF,
15
+ BACHELOR090_PDF,
16
+ MASTER116_PDF,
17
+ ]
@@ -0,0 +1,81 @@
1
+ [project]
2
+ name = "utilotest"
3
+ version = "1.0.1"
4
+ description = ""
5
+ readme = {file = "README", content-type = "text/markdown"}
6
+ requires-python = ">=3.12"
7
+ authors = [
8
+ {name = "Helmut Konrad Schewe", email = "helmutus@outlook.com"}
9
+ ]
10
+
11
+ dependencies = [
12
+ "utilo>=2.107.0,<3.0.0",
13
+ "configos>=1.0.2,<2.0.0",
14
+ "resinf>=1.0.2,<2.0.0",
15
+
16
+ "pytest>=9.0.2,<10.0.0",
17
+ ]
18
+
19
+ # Optional but recommended metadata
20
+ keywords = []
21
+ classifiers = [
22
+ 'Programming Language :: Python :: 3.12',
23
+ 'Programming Language :: Python :: 3.13',
24
+ 'Programming Language :: Python :: 3.14',
25
+ ]
26
+ license = "MIT"
27
+ license-files = ["LICENSE"]
28
+
29
+ [project.scripts]
30
+ collect_trace="utilotest.cli.tracer:main"
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "selenium==4.41.0",
35
+
36
+ "pytest_localserver==0.7.0",
37
+ # power==2.24.0
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/anaticulae/utilotest"
42
+ Repository = "https://github.com/anaticulae/utilotest"
43
+
44
+ [build-system]
45
+ requires = [
46
+ "setuptools>=82.0.1",
47
+ "wheel>=0.46.3"
48
+ ]
49
+ build-backend = "setuptools.build_meta"
50
+
51
+
52
+ [tool.semantic_release]
53
+ version_toml = ["pyproject.toml:project.version"]
54
+ [tool.semantic_release.changelog.default_templates]
55
+ changelog_file = "CHANGELOG"
56
+ [tool.semantic_release.changelog]
57
+ mode = "init"
58
+ output_format = "md"
59
+ [tool.semantic_release.commit_parser_options]
60
+ # allways generate a new version
61
+ patch_tags = ["fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "test", "deps"]
62
+
63
+ [tool.setuptools.packages.find]
64
+ where = ["."]
65
+ include = [
66
+ "power",
67
+ "utilotest",
68
+ "utilotest.cli",
69
+ "viewvisitor",
70
+ ]
71
+ exclude = [
72
+ "tests*",
73
+ ]
74
+
75
+ [tool.setuptools.package-data]
76
+ viewvisitor = [
77
+ "fuchs/*",
78
+ ]
79
+
80
+ [tool.setuptools]
81
+ include-package-data = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,41 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2021-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import pytest
11
+ import utilo
12
+
13
+ import utilotest
14
+
15
+
16
+ class Simple(utilotest.BaseLiner):
17
+
18
+ def __init__(self):
19
+ super().__init__(
20
+ program='power',
21
+ step='help >> message',
22
+ pages='',
23
+ workdir='',
24
+ source='',
25
+ index='message',
26
+ loader=lambda x: utilo.file_read('message').strip(),
27
+ archive='archive',
28
+ )
29
+
30
+
31
+ # def test_baseline_mixin_valid(td):
32
+ # td.mkdir('archive')
33
+ # utilo.run('power -h >> archive/message')
34
+ # Simple().evaluate()
35
+
36
+
37
+ def test_baseline_mixin_invalid(td):
38
+ td.mkdir('archive')
39
+ utilo.run('echo "invalid comparison" >> archive/message')
40
+ with pytest.raises(AssertionError):
41
+ Simple().evaluate()
@@ -0,0 +1,18 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2022-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import configos
11
+
12
+ import utilotest
13
+
14
+
15
+ def test_setup(mp):
16
+ api = configos.HV_API('/api/v0')
17
+ with mp.context():
18
+ utilotest.setup(api)
@@ -0,0 +1,38 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2019-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import pytest
11
+ import utilo
12
+
13
+ import utilotest
14
+
15
+
16
+ def test_increased_filecount(td):
17
+ with utilotest.increased_filecount(td.tmpdir):
18
+ utilo.file_create('test.txt')
19
+
20
+
21
+ def test_increased_filecount_with_number(td):
22
+ with utilotest.increased_filecount(td.tmpdir, mindiff=1, maxdiff=1):
23
+ utilo.file_create('test.txt')
24
+
25
+
26
+ def test_increased_filecount_with_ext(td):
27
+ with pytest.raises(AssertionError):
28
+ with utilotest.increased_filecount(td.tmpdir, ext='*.pdf'):
29
+ utilo.file_create('test_abc.txt')
30
+
31
+
32
+ def test_increased_filecount_to_few_created(td):
33
+ with pytest.raises(AssertionError):
34
+ with utilotest.increased_filecount(td.tmpdir):
35
+ pass
36
+ with pytest.raises(AssertionError):
37
+ with utilotest.increased_filecount(td.tmpdir, mindiff=2):
38
+ utilo.file_create('test.txt')
@@ -0,0 +1,64 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2019-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ # import sys
11
+ # import threading
12
+
13
+ # import pytest
14
+ # import utilo
15
+
16
+ # import utilotest
17
+
18
+ # PACKAGE = """\
19
+ # import setuptools
20
+ # setuptools.setup(
21
+ # name='%s',
22
+ # packages=['%s'],
23
+ # )
24
+ # """
25
+
26
+ # linux = not sys.platform.startswith("win")
27
+
28
+ # class TestClass:
29
+
30
+ # LOCK = threading.Lock()
31
+
32
+ # @utilotest.nonvirtual
33
+ # @utilotest.longrun
34
+ # def test_clean_install(_, td):
35
+ # if linux:
36
+ # pytest.skip('enable later')
37
+ # with TestClass.LOCK:
38
+ # package = 'dorimifasa'
39
+ # td.mkdir(package)
40
+ # utilo.file_create(
41
+ # td.tmpdir.join('setup.py'),
42
+ # PACKAGE % (package, package),
43
+ # )
44
+ # utilo.run('python setup.py build')
45
+ # utilotest.clean_install(
46
+ # td.tmpdir,
47
+ # 'dorimifasa',
48
+ # )
49
+ # # @utilotest.nonvirtual
50
+ # # @utilotest.longrun
51
+ # # def test_install_and_run(self, td): # pylint:disable=R0201
52
+ # with TestClass.LOCK:
53
+ # package = 'dorimifasamore'
54
+ # # td.mkdir(package)
55
+ # # utilo.file_create(
56
+ # # td.tmpdir.join('setup.py'),
57
+ # # PACKAGE % (package, package),
58
+ # # )
59
+ # utilo.run('python setup.py build')
60
+ # utilotest.install_and_run(
61
+ # root=td.tmpdir,
62
+ # package=package,
63
+ # executable='power', # not the installed one
64
+ # )
@@ -0,0 +1,57 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2019-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import pytest
11
+ import utilo
12
+
13
+ import utilotest
14
+
15
+
16
+ def test_log_raw(capsys):
17
+ content = 'Hello\nHello\nHello'
18
+
19
+ with pytest.raises(AssertionError):
20
+ assert len(content) > 1000, utilotest.log_raw(content)
21
+
22
+ assert content in utilotest.stdout(capsys)
23
+
24
+
25
+ def test_stdout_stderr(capsys):
26
+ utilo.error('abc')
27
+ assert 'abc' in utilotest.stderr(capsys)
28
+
29
+ utilo.log('www')
30
+ assert 'www' in utilotest.stdout(capsys)
31
+
32
+
33
+ EXPECTED = """\
34
+ Before
35
+ A
36
+ 10
37
+ B
38
+ 100
39
+ After
40
+ """
41
+
42
+
43
+ def test_printresult(capsys):
44
+
45
+ @utilotest.print_return
46
+ def buddy(value):
47
+ utilo.log('A')
48
+ utilo.log(value)
49
+ utilo.log('B')
50
+ return value * value
51
+
52
+ utilo.log('Before')
53
+ with utilo.level_tmp(utilo.Level.DEBUG):
54
+ buddy(10)
55
+ utilo.log('After')
56
+ current = utilotest.stdout(capsys)
57
+ assert current == EXPECTED
@@ -0,0 +1,65 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2021-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import os
11
+
12
+ # pylint: disable=wrong-import-order
13
+ import power
14
+ import resinf
15
+ import utilo
16
+
17
+ TESTCODE = """\
18
+ import power
19
+ import resinf
20
+
21
+ import utilotest
22
+
23
+ resinf.setup(root='%s', validate=False)
24
+
25
+ @utilotest.requires(power.DOCU007_PDF)
26
+ def test_master():
27
+ pass
28
+ """
29
+
30
+
31
+ def test_requires_singletd(td):
32
+ root = utilo.forward_slash(str(td.tmpdir))
33
+ testcode = TESTCODE % root
34
+ utilo.file_create(os.path.join(root, 'test_master.py'), testcode)
35
+ completed = utilo.run(f'pytest {root}')
36
+ assert '==== 1 skipped' in completed.stdout
37
+
38
+
39
+ def test_requires_noskip(td):
40
+ root = utilo.forward_slash(str(td.tmpdir.join(utilo.tmpname())))
41
+ td.mkdir(root)
42
+ testcode = TESTCODE % root
43
+ os.makedirs(resinf.link(power.DOCU007_PDF, project=root))
44
+ utilo.file_create(os.path.join(root, 'test_master.py'), testcode)
45
+ completed = utilo.run(f'pytest {root}')
46
+ assert '1 skipped in' not in completed.stdout
47
+
48
+
49
+ STACK = """\
50
+ @utilotest.requires(power.DOCU007_PDF)
51
+ @utilotest.requires(power.DOCU009_PDF)
52
+ def test_stacked():
53
+ pass
54
+ """
55
+
56
+
57
+ def test_requires_stacked_resource(td):
58
+ """Require more than one generated path to run test."""
59
+ root = utilo.forward_slash(str(td.tmpdir.join(utilo.tmpname())))
60
+ td.mkdir(root)
61
+ testcode = TESTCODE % root + STACK
62
+ utilo.file_create(os.path.join(root, 'test_master.py'), testcode)
63
+ os.makedirs(resinf.link(power.DOCU007_PDF, project=root))
64
+ completed = utilo.run(f'pytest {root}')
65
+ assert '1 passed, 1 skipped' in completed.stdout
@@ -0,0 +1,63 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2019-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import sys
11
+
12
+ import pytest
13
+ import utilo
14
+
15
+ import utilotest
16
+
17
+
18
+ def test_run(tmpdir):
19
+ completed = utilotest.run('ls', tmpdir)
20
+ assert completed.returncode == utilo.SUCCESS
21
+
22
+ with utilotest.assert_run('ls', tmpdir) as result:
23
+ assert result.returncode == utilo.SUCCESS # pylint:disable=E1101
24
+
25
+ with utilotest.assert_run_fail('this is not a command', tmpdir) as result:
26
+ assert result.returncode >= utilo.FAILURE # pylint:disable=E1101
27
+
28
+
29
+ def test_run_cov(mp):
30
+
31
+ def main():
32
+ # example runnable
33
+ sys.exit(utilo.SUCCESS)
34
+
35
+ utilotest.run_cov(
36
+ '--number 10',
37
+ 'main',
38
+ main,
39
+ expect=True,
40
+ mp=mp,
41
+ )
42
+
43
+
44
+ def test_assert_success():
45
+ completed = utilotest.run('python --help')
46
+ utilotest.assert_success(completed)
47
+
48
+
49
+ def test_assert_success_failed():
50
+ completed = utilotest.run('python --helpsambadamba', expect=None)
51
+ with pytest.raises(AssertionError):
52
+ utilotest.assert_success(completed)
53
+
54
+
55
+ def test_assert_failure():
56
+ completed = utilotest.run('python --helpsambadamba', expect=None)
57
+ utilotest.assert_failure(completed)
58
+
59
+
60
+ def test_assert_failure_failed():
61
+ completed = utilotest.run('python --help')
62
+ with pytest.raises(AssertionError):
63
+ utilotest.assert_failure(completed)
@@ -0,0 +1,21 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2021-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import utilotest
11
+
12
+
13
+ @utilotest.win
14
+ @utilotest.longrun
15
+ @utilotest.displayed
16
+ def test_selenium_driver(selenium_driver, httpserver):
17
+ httpserver.serve_content('<div id="helmut">Helmut is talking</div>')
18
+ # visit faked page
19
+ selenium_driver.get(httpserver.url)
20
+ text = selenium_driver.find_element_by_id('helmut').text
21
+ assert text == 'Helmut is talking'
@@ -0,0 +1,43 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2021-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import pytest
11
+ import utilo
12
+
13
+ import utilotest.cli.tracer
14
+
15
+ TRACEBACK = """
16
+ [ERROR] Traceback (most recent call last):
17
+ File "C:/tmp/baw/venv/queuemo/lib/site-packages/utilo/feature/processor.py", line 238, in run_hook_safely
18
+ result = utilo.pass_required(caller=hook.work, pages=pages, **argv)
19
+ File "C:/tmp/baw/venv/queuemo/lib/site-packages/utilo/typechecker.py", line 309, in pass_required
20
+ result = caller(**data)
21
+ File "C:/tmp/baw/venv/queuemo/lib/site-packages/groupme/feature/footer.py", line 61, in work
22
+ result = extract_footerheader(
23
+ """
24
+
25
+ INVALID_CLI = """
26
+ usage: bibliography [-h] [-i INPUT] [-o OUTPUT] [-j JOB] [-V]
27
+ bibliography: error: unrecognized arguments: --bibs
28
+ """
29
+
30
+
31
+ @pytest.mark.parametrize('error', (
32
+ pytest.param(TRACEBACK, id='python error'),
33
+ pytest.param(INVALID_CLI, id='invalid cli'),
34
+ ))
35
+ def test_tracer(error, td): # pylint:disable=W0613
36
+ # add file with traceback message
37
+ utilo.file_create('generated.log', error)
38
+ # run tracer
39
+ with pytest.raises(SystemExit):
40
+ utilotest.cli.tracer.main()
41
+ # collect result
42
+ traced = utilo.file_list(utilotest.cli.tracer.OUTPUTDIR)
43
+ assert len(traced) == 1
@@ -0,0 +1,53 @@
1
+ # =============================================================================
2
+ # C O P Y R I G H T
3
+ # -----------------------------------------------------------------------------
4
+ # Copyright (c) 2019-2023 by Helmut Konrad Schewe. All rights reserved.
5
+ # This file is property of Helmut Konrad Schewe. Any unauthorized copy,
6
+ # use or distribution is an offensive act against international law and may
7
+ # be prosecuted under federal law. Its content is company confidential.
8
+ # =============================================================================
9
+
10
+ import webbrowser
11
+
12
+ # pylint: disable=wrong-import-order
13
+ import power
14
+ import utilo
15
+
16
+ import utilotest
17
+
18
+
19
+ def test_open_webbrowser(td, mp):
20
+ # NOTE: don't know if that is a good test
21
+ path = utilo.join(td.tmpdir, 'index.html')
22
+ utilo.file_create(path, 'Hello World')
23
+
24
+ called = False
25
+
26
+ def open_url(url, new=0, autoraise=True): # pylint:disable=W0613
27
+ nonlocal called
28
+ called = True
29
+
30
+ with mp.context() as context:
31
+ context.setattr(utilotest, 'single_execution', lambda: True)
32
+ context.setattr(webbrowser, 'open', open_url)
33
+ with utilotest.open_webbrowser(path):
34
+ pass
35
+ assert called
36
+
37
+
38
+ def test_test_resources():
39
+
40
+ def markme(item):
41
+ if item == power.BACHELOR028_PDF:
42
+ return utilotest.longrun
43
+ return None
44
+
45
+ resources = utilotest.test_resources(
46
+ [
47
+ power.BACHELOR028_PDF,
48
+ power.MASTER116_PDF,
49
+ ],
50
+ marker=markme,
51
+ )
52
+ raw = str(resources)
53
+ assert 'longrun' in raw