comparison tests/_tsetup.py @ 16:b92f660f2461

Begin a test infrastructure: using unittest and flake8. Need a requirements-dev.txt now also.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 20 Apr 2026 13:31:42 +0200
parents
children 251898f2f0c7
comparison
equal deleted inserted replaced
15:db0171f62e5a 16:b92f660f2461
1 # -*- coding: utf-8 -*-
2 # :-
3 # SPDX-FileCopyrightText: © 2026 Franz Glasner
4 # SPDX-License-Identifier: MIT
5 r"""Automatic unittest context configuration.
6
7 Side-effects of import configure the test environment!
8
9 """
10
11 import logging
12 import os
13 import sys
14
15
16 sys.path.insert(
17 0,
18 os.path.abspath(
19 os.path.normpath(os.path.join(os.path.dirname(__file__), ".."))))
20
21
22 TESTDATADIR = os.path.join(
23 os.path.abspath(os.path.dirname(__file__)),
24 "data")
25
26
27 # Setup logging for the unittests: use a known fixed format w/o time
28 logging.captureWarnings(True)
29 logging.basicConfig(
30 level=logging.DEBUG,
31 style='%',
32 format="[%(name)s][%(filename)s:%(lineno)d:%(funcName)s][%(levelname)s] %(message)s") # noqa: E501 (line too long)