conftest.py 381 Bytes
Newer Older
zzg_666's avatar
zzg_666 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os
import pytest

@pytest.fixture(autouse=True, scope="session")  # 自动应用,无需标记
def set_test_dir():
    # 强制切换工作目录到 /tests
    tests_dir = os.path.join(os.path.dirname(__file__))
    os.chdir(tests_dir)

import threading, atexit

def show_threads():
    print("Alive threads at exit:", threading.enumerate())

atexit.register(show_threads)