Enable integration tests to be run concurrently

This commit is contained in:
Serene-Arc
2021-06-24 16:14:05 +10:00
parent 3dacaf0872
commit 31be3a916e

View File

@@ -2,6 +2,7 @@
# coding=utf-8 # coding=utf-8
import re import re
import shutil
from pathlib import Path from pathlib import Path
import pytest import pytest
@@ -12,22 +13,28 @@ from bdfr.__main__ import cli
does_test_config_exist = Path('test_config.cfg').exists() does_test_config_exist = Path('test_config.cfg').exists()
def copy_test_config(tmp_path: Path):
shutil.copy(Path('test_config.cfg'), Path(tmp_path, 'test_config.cfg'))
def create_basic_args_for_download_runner(test_args: list[str], tmp_path: Path): def create_basic_args_for_download_runner(test_args: list[str], tmp_path: Path):
copy_test_config(tmp_path)
out = [ out = [
'download', str(tmp_path), 'download', str(tmp_path),
'-v', '-v',
'--config', 'test_config.cfg', '--config', str(Path(tmp_path, 'test_config.cfg')),
'--log', str(Path(tmp_path, 'test_log.txt')), '--log', str(Path(tmp_path, 'test_log.txt')),
] + test_args ] + test_args
return out return out
def create_basic_args_for_archive_runner(test_args: list[str], tmp_path: Path): def create_basic_args_for_archive_runner(test_args: list[str], tmp_path: Path):
copy_test_config(tmp_path)
out = [ out = [
'archive', 'archive',
str(tmp_path), str(tmp_path),
'-v', '-v',
'--config', 'test_config.cfg', '--config', str(Path(tmp_path, 'test_config.cfg')),
'--log', str(Path(tmp_path, 'test_log.txt')), '--log', str(Path(tmp_path, 'test_log.txt')),
] + test_args ] + test_args
return out return out