Passed
Pull Request — master (#6)
by Jan
03:55
created

tests.conftest.remove_generated_file()   A

Complexity

Conditions 3

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
import os
2
import tempfile
3
from glob import glob
4
from pathlib import Path
5
6
import pytest
7
8
9
@pytest.fixture()
10
def remove_generated_file():
11
    # Removes all files in /tmp which name starts with oscap-report-tests_*
12
    yield
13
    pattern = str(Path(tempfile.gettempdir()) / "oscap-report-tests_*")
14
    for item in glob(pattern):
15
        if not os.path.isdir(item):
16
            os.remove(item)
17