Change benchmark plugin layout so pytest loads it properly when running

all tests (not necessary performance ones)

resolves #837
This commit is contained in:
Dmitry Rodionov
2021-11-04 13:02:09 +03:00
committed by Dmitry Rodionov
parent 33007cc0bb
commit c75bc9b8b0
4 changed files with 11 additions and 12 deletions

View File

@@ -1 +1 @@
pytest_plugins = ("fixtures.zenith_fixtures")
pytest_plugins = ("fixtures.zenith_fixtures", "fixtures.benchmark_fixture")

View File

@@ -16,7 +16,7 @@ import warnings
from contextlib import contextmanager
# Type-related stuff
from typing import Iterator, Optional
from typing import Iterator
"""
This file contains fixtures for micro-benchmarks.
@@ -314,6 +314,14 @@ def zenbenchmark(record_property) -> Iterator[ZenithBenchmarker]:
yield benchmarker
def pytest_addoption(parser):
parser.addoption(
"--out-dir",
dest="out_dir",
help="Directory to ouput performance tests results to.",
)
def get_out_path(target_dir: Path, revision: str) -> Path:
"""
get output file path

View File

@@ -12,14 +12,13 @@ import json
import psycopg2
import pytest
import shutil
import signal
import socket
import subprocess
import time
import filecmp
import tempfile
from contextlib import closing, suppress
from contextlib import closing
from pathlib import Path
from dataclasses import dataclass

View File

@@ -1,8 +0,0 @@
# pytest some has quirks with discovering plugins, so having it there just works
# probably we should create custom plugin and add it to pytest config to always have needed things at hand
def pytest_addoption(parser):
parser.addoption(
"--out-dir",
dest="out_dir",
help="Directory to ouput performance tests results to.",
)