tests.conftest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A remove_generated_file() 0 8 3
1
# Copyright 2022, Red Hat, Inc.
2
# SPDX-License-Identifier: LGPL-2.1-or-later
3
4
import os
5
import tempfile
6
from glob import glob
7
from pathlib import Path
8
9
import pytest
10
11
12
@pytest.fixture()
13
def remove_generated_file():
14
    # Removes all files in /tmp which name starts with oscap-report-tests_*
15
    yield
16
    pattern = str(Path(tempfile.gettempdir()) / "oscap-report-tests_*")
17
    for item in glob(pattern):
18
        if not os.path.isdir(item):
19
            os.remove(item)
20