File: init_tests.py

package info (click to toggle)
python-josepy 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 476 kB
  • sloc: python: 2,573; makefile: 27
file content (25 lines) | stat: -rwxr-xr-x 641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import importlib
import re
import sys
import warnings

import pytest

import josepy


@pytest.mark.skipif(sys.version_info[:2] != (3, 9), reason="requires Python 3.9")
def test_warns() -> None:
    with pytest.warns(DeprecationWarning, match=re.escape(r"Python 3.9 support")):
        importlib.reload(josepy)


@pytest.mark.skipif(sys.version_info[:2] == (3, 9), reason="requires Python != 3.9")
def test_does_not_warn() -> None:
    with warnings.catch_warnings():
        warnings.simplefilter("error")
        importlib.reload(josepy)


if __name__ == "__main__":
    sys.exit(pytest.main(sys.argv[1:] + [__file__]))  # pragma: no cover