Mercurial > hgrepos > Python > libs > ConfigMix
annotate tests/_test_context.py @ 654:0d6673d06c2c
Add support for using "tomllib" (in Python's stdlib since 3.11) and "tomli" TOML packages.
They are preferred if they are found to be installed.
But note that the declared dependency for the "toml" extra nevertheless
is the "toml" package. Because it is available for all supported Python
versions.
So use Python 3.11+ or install "tomli" manually if you want to use the
alternate packages.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 19 May 2022 22:10:59 +0200 |
| parents | 75ecbe07abff |
| children |
| rev | line source |
|---|---|
|
619
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
2 r"""Automatic unittest context configuration |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
3 |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
4 """ |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
5 |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
6 import sys |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
7 import os |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
8 |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
9 sys.path.insert( |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
10 0, |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
11 os.path.abspath( |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
12 os.path.normpath(os.path.join(os.path.dirname(__file__), "..")))) |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
13 |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
14 |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
15 TESTDATADIR = os.path.join( |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
16 os.path.abspath(os.path.dirname(__file__)), |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
diff
changeset
|
17 "data") |
