File: test_lxml_version.py

package info (click to toggle)
daps 3.3.2%2Bcleaned1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,540 kB
  • sloc: xml: 9,773; sh: 3,059; python: 1,322; lisp: 380; makefile: 239
file content (19 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import pytest


def test_required_lxml(monkeypatch):
    # Given
    from lxml import etree
    import sys

    module = "dxwf"
    if module in sys.modules:
        # Force deleting them if it is already loaded from
        # other tests
        del sys.modules[module]

    with monkeypatch.context() as m:
        # simulate a very low version of lxml
        m.setattr(etree, "LXML_VERSION", (1, 42, 42, 0))
        with pytest.raises(SystemExit):
            import dxwf