diff --git a/test_runner/batch_others/test_auth.py b/test_runner/batch_others/test_auth.py index 0ef385a001..7f86986e2e 100644 --- a/test_runner/batch_others/test_auth.py +++ b/test_runner/batch_others/test_auth.py @@ -5,8 +5,6 @@ import psycopg2 from fixtures.zenith_fixtures import ZenithEnvBuilder, ZenithPageserverApiException import pytest -pytest_plugins = ("fixtures.zenith_fixtures") - def test_pageserver_auth(zenith_env_builder: ZenithEnvBuilder): zenith_env_builder.pageserver_auth_enabled = True diff --git a/test_runner/batch_others/test_branch_behind.py b/test_runner/batch_others/test_branch_behind.py index 73e38bba7f..860db51c8a 100644 --- a/test_runner/batch_others/test_branch_behind.py +++ b/test_runner/batch_others/test_branch_behind.py @@ -7,8 +7,6 @@ from fixtures.log_helper import log from fixtures.utils import print_gc_result from fixtures.zenith_fixtures import ZenithEnvBuilder -pytest_plugins = ("fixtures.zenith_fixtures") - # # Create a couple of branches off the main branch, at a historical point in time. diff --git a/test_runner/batch_others/test_clog_truncate.py b/test_runner/batch_others/test_clog_truncate.py index d1cb919d2f..504f455936 100644 --- a/test_runner/batch_others/test_clog_truncate.py +++ b/test_runner/batch_others/test_clog_truncate.py @@ -6,8 +6,6 @@ from contextlib import closing from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test compute node start after clog truncation diff --git a/test_runner/batch_others/test_config.py b/test_runner/batch_others/test_config.py index 0f1425c2a4..fd2b3b4e99 100644 --- a/test_runner/batch_others/test_config.py +++ b/test_runner/batch_others/test_config.py @@ -3,8 +3,6 @@ from contextlib import closing from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test starting Postgres with custom options diff --git a/test_runner/batch_others/test_createdropdb.py b/test_runner/batch_others/test_createdropdb.py index 24d575a868..38243b298b 100644 --- a/test_runner/batch_others/test_createdropdb.py +++ b/test_runner/batch_others/test_createdropdb.py @@ -5,8 +5,6 @@ from contextlib import closing from fixtures.zenith_fixtures import ZenithEnv, check_restored_datadir_content from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test CREATE DATABASE when there have been relmapper changes diff --git a/test_runner/batch_others/test_createuser.py b/test_runner/batch_others/test_createuser.py index 398c533935..1959b47dcc 100644 --- a/test_runner/batch_others/test_createuser.py +++ b/test_runner/batch_others/test_createuser.py @@ -3,8 +3,6 @@ from contextlib import closing from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test CREATE USER to check shared catalog restore diff --git a/test_runner/batch_others/test_gc_aggressive.py b/test_runner/batch_others/test_gc_aggressive.py index 1e8a0df723..9de6ba9f59 100644 --- a/test_runner/batch_others/test_gc_aggressive.py +++ b/test_runner/batch_others/test_gc_aggressive.py @@ -7,8 +7,6 @@ import random from fixtures.zenith_fixtures import ZenithEnv, Postgres, Safekeeper from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # Test configuration # # Create a table with {num_rows} rows, and perform {updates_to_perform} random diff --git a/test_runner/batch_others/test_multixact.py b/test_runner/batch_others/test_multixact.py index 57072a87b3..6a2afd2ede 100644 --- a/test_runner/batch_others/test_multixact.py +++ b/test_runner/batch_others/test_multixact.py @@ -1,8 +1,6 @@ from fixtures.zenith_fixtures import ZenithEnv, check_restored_datadir_content from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test multixact state after branching diff --git a/test_runner/batch_others/test_next_xid.py b/test_runner/batch_others/test_next_xid.py index 8a92cec749..625abc39d3 100644 --- a/test_runner/batch_others/test_next_xid.py +++ b/test_runner/batch_others/test_next_xid.py @@ -5,8 +5,6 @@ import time from fixtures.zenith_fixtures import ZenithEnvBuilder from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # Test restarting page server, while safekeeper and compute node keep # running. diff --git a/test_runner/batch_others/test_old_request_lsn.py b/test_runner/batch_others/test_old_request_lsn.py index d6f00ac44e..d09fb24913 100644 --- a/test_runner/batch_others/test_old_request_lsn.py +++ b/test_runner/batch_others/test_old_request_lsn.py @@ -3,8 +3,6 @@ from contextlib import closing from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test where Postgres generates a lot of WAL, and it's garbage collected away, but diff --git a/test_runner/batch_others/test_pageserver_api.py b/test_runner/batch_others/test_pageserver_api.py index d2e1eaac77..eccffc4d69 100644 --- a/test_runner/batch_others/test_pageserver_api.py +++ b/test_runner/batch_others/test_pageserver_api.py @@ -4,8 +4,6 @@ from fixtures.zenith_fixtures import ZenithEnv, ZenithEnvBuilder, ZenithPageserv from typing import cast import pytest, psycopg2 -pytest_plugins = ("fixtures.zenith_fixtures") - def check_client(client: ZenithPageserverHttpClient, initial_tenant: UUID): client.check_status() diff --git a/test_runner/batch_others/test_pageserver_catchup.py b/test_runner/batch_others/test_pageserver_catchup.py index a57aab0863..97dc0f3260 100644 --- a/test_runner/batch_others/test_pageserver_catchup.py +++ b/test_runner/batch_others/test_pageserver_catchup.py @@ -7,8 +7,6 @@ from multiprocessing import Process, Value from fixtures.zenith_fixtures import ZenithEnvBuilder from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # Test safekeeper sync and pageserver catch up # while initial compute node is down and pageserver is lagging behind safekeepers. diff --git a/test_runner/batch_others/test_pageserver_restart.py b/test_runner/batch_others/test_pageserver_restart.py index e48e1ff7c6..0cfc50f0ff 100644 --- a/test_runner/batch_others/test_pageserver_restart.py +++ b/test_runner/batch_others/test_pageserver_restart.py @@ -7,8 +7,6 @@ from multiprocessing import Process, Value from fixtures.zenith_fixtures import ZenithEnvBuilder from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # Test restarting page server, while safekeeper and compute node keep # running. diff --git a/test_runner/batch_others/test_parallel_copy.py b/test_runner/batch_others/test_parallel_copy.py index 13038273fb..6f87bc4a36 100644 --- a/test_runner/batch_others/test_parallel_copy.py +++ b/test_runner/batch_others/test_parallel_copy.py @@ -5,8 +5,6 @@ import subprocess from fixtures.zenith_fixtures import ZenithEnv, Postgres from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - async def repeat_bytes(buf, repetitions: int): for i in range(repetitions): diff --git a/test_runner/batch_others/test_pgbench.py b/test_runner/batch_others/test_pgbench.py index 4d1c14345d..09713023bc 100644 --- a/test_runner/batch_others/test_pgbench.py +++ b/test_runner/batch_others/test_pgbench.py @@ -1,8 +1,6 @@ from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - def test_pgbench(zenith_simple_env: ZenithEnv, pg_bin): env = zenith_simple_env diff --git a/test_runner/batch_others/test_readonly_node.py b/test_runner/batch_others/test_readonly_node.py index e8f7e96f39..ba256e71f7 100644 --- a/test_runner/batch_others/test_readonly_node.py +++ b/test_runner/batch_others/test_readonly_node.py @@ -2,8 +2,6 @@ import pytest from fixtures.log_helper import log from fixtures.zenith_fixtures import ZenithEnv -pytest_plugins = ("fixtures.zenith_fixtures") - # # Create read-only compute nodes, anchored at historical points in time. diff --git a/test_runner/batch_others/test_remote_storage.py b/test_runner/batch_others/test_remote_storage.py index 5be66266ac..fa6feaf412 100644 --- a/test_runner/batch_others/test_remote_storage.py +++ b/test_runner/batch_others/test_remote_storage.py @@ -9,8 +9,6 @@ from fixtures.zenith_fixtures import ZenithEnvBuilder from fixtures.log_helper import log import pytest -pytest_plugins = ("fixtures.zenith_fixtures") - # # Tests that a piece of data is backed up and restored correctly: diff --git a/test_runner/batch_others/test_restart_compute.py b/test_runner/batch_others/test_restart_compute.py index 3661246293..f7810be555 100644 --- a/test_runner/batch_others/test_restart_compute.py +++ b/test_runner/batch_others/test_restart_compute.py @@ -4,8 +4,6 @@ from contextlib import closing from fixtures.zenith_fixtures import ZenithEnvBuilder from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test restarting and recreating a postgres instance diff --git a/test_runner/batch_others/test_snapfiles_gc.py b/test_runner/batch_others/test_snapfiles_gc.py index 0381a24b45..c6d4512bc9 100644 --- a/test_runner/batch_others/test_snapfiles_gc.py +++ b/test_runner/batch_others/test_snapfiles_gc.py @@ -5,8 +5,6 @@ from fixtures.utils import print_gc_result from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test Garbage Collection of old layer files diff --git a/test_runner/batch_others/test_subxacts.py b/test_runner/batch_others/test_subxacts.py index 3729ea4ece..bed1c4be63 100644 --- a/test_runner/batch_others/test_subxacts.py +++ b/test_runner/batch_others/test_subxacts.py @@ -1,8 +1,6 @@ from fixtures.zenith_fixtures import ZenithEnv, check_restored_datadir_content from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # Test subtransactions # diff --git a/test_runner/batch_others/test_twophase.py b/test_runner/batch_others/test_twophase.py index b6589c09ab..d6a1cd01e8 100644 --- a/test_runner/batch_others/test_twophase.py +++ b/test_runner/batch_others/test_twophase.py @@ -3,8 +3,6 @@ import os from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test branching, when a transaction is in prepared state @@ -80,8 +78,8 @@ def test_twophase(zenith_simple_env: ZenithEnv): cur2.execute("ROLLBACK PREPARED 'insert_two'") cur2.execute('SELECT * FROM foo') - assert cur2.fetchall() == [('one', ), ('three', )] # type: ignore[comparison-overlap] + assert cur2.fetchall() == [('one', ), ('three', )] # Only one committed insert is visible on the original branch cur.execute('SELECT * FROM foo') - assert cur.fetchall() == [('three', )] # type: ignore[comparison-overlap] + assert cur.fetchall() == [('three', )] diff --git a/test_runner/batch_others/test_vm_bits.py b/test_runner/batch_others/test_vm_bits.py index 382b0880f9..49e48dd450 100644 --- a/test_runner/batch_others/test_vm_bits.py +++ b/test_runner/batch_others/test_vm_bits.py @@ -1,8 +1,6 @@ from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - # # Test that the VM bit is cleared correctly at a HEAP_DELETE and diff --git a/test_runner/batch_others/test_wal_acceptor.py b/test_runner/batch_others/test_wal_acceptor.py index 2f58cbaee9..193afc1b86 100644 --- a/test_runner/batch_others/test_wal_acceptor.py +++ b/test_runner/batch_others/test_wal_acceptor.py @@ -17,8 +17,6 @@ from fixtures.utils import lsn_to_hex, mkdir_if_needed from fixtures.log_helper import log from typing import List, Optional, Any -pytest_plugins = ("fixtures.zenith_fixtures") - # basic test, write something in setup with wal acceptors, ensure that commits # succeed and data is written diff --git a/test_runner/batch_others/test_wal_acceptor_async.py b/test_runner/batch_others/test_wal_acceptor_async.py index 1c965f1acc..1d2a186eb7 100644 --- a/test_runner/batch_others/test_wal_acceptor_async.py +++ b/test_runner/batch_others/test_wal_acceptor_async.py @@ -9,7 +9,6 @@ from fixtures.utils import lsn_from_hex, lsn_to_hex from typing import List log = getLogger('root.wal_acceptor_async') -pytest_plugins = ("fixtures.zenith_fixtures") class BankClient(object): diff --git a/test_runner/batch_others/test_zenith_cli.py b/test_runner/batch_others/test_zenith_cli.py index 6517222ee3..ce051dfd6e 100644 --- a/test_runner/batch_others/test_zenith_cli.py +++ b/test_runner/batch_others/test_zenith_cli.py @@ -6,8 +6,6 @@ from psycopg2.extensions import cursor as PgCursor from fixtures.zenith_fixtures import ZenithEnv, ZenithEnvBuilder, ZenithPageserverHttpClient from typing import cast -pytest_plugins = ("fixtures.zenith_fixtures") - def helper_compare_branch_list(pageserver_http_client: ZenithPageserverHttpClient, env: ZenithEnv, diff --git a/test_runner/batch_pg_regress/test_isolation.py b/test_runner/batch_pg_regress/test_isolation.py index f192f01e8a..ddafc3815b 100644 --- a/test_runner/batch_pg_regress/test_isolation.py +++ b/test_runner/batch_pg_regress/test_isolation.py @@ -3,8 +3,6 @@ import os from fixtures.utils import mkdir_if_needed from fixtures.zenith_fixtures import ZenithEnv, base_dir, pg_distrib_dir -pytest_plugins = ("fixtures.zenith_fixtures") - def test_isolation(zenith_simple_env: ZenithEnv, test_output_dir, pg_bin, capsys): env = zenith_simple_env diff --git a/test_runner/batch_pg_regress/test_pg_regress.py b/test_runner/batch_pg_regress/test_pg_regress.py index c31cccab23..5199f65216 100644 --- a/test_runner/batch_pg_regress/test_pg_regress.py +++ b/test_runner/batch_pg_regress/test_pg_regress.py @@ -3,8 +3,6 @@ import os from fixtures.utils import mkdir_if_needed from fixtures.zenith_fixtures import ZenithEnv, check_restored_datadir_content, base_dir, pg_distrib_dir -pytest_plugins = ("fixtures.zenith_fixtures") - def test_pg_regress(zenith_simple_env: ZenithEnv, test_output_dir: str, pg_bin, capsys): env = zenith_simple_env diff --git a/test_runner/batch_pg_regress/test_zenith_regress.py b/test_runner/batch_pg_regress/test_zenith_regress.py index 50940a1371..31d5b07093 100644 --- a/test_runner/batch_pg_regress/test_zenith_regress.py +++ b/test_runner/batch_pg_regress/test_zenith_regress.py @@ -7,8 +7,6 @@ from fixtures.zenith_fixtures import (ZenithEnv, pg_distrib_dir) from fixtures.log_helper import log -pytest_plugins = ("fixtures.zenith_fixtures") - def test_zenith_regress(zenith_simple_env: ZenithEnv, test_output_dir, pg_bin, capsys): env = zenith_simple_env diff --git a/test_runner/fixtures/benchmark_fixture.py b/test_runner/fixtures/benchmark_fixture.py index 002f0a88b4..480eb3f891 100644 --- a/test_runner/fixtures/benchmark_fixture.py +++ b/test_runner/fixtures/benchmark_fixture.py @@ -27,8 +27,6 @@ bencmark, and then record the result by calling zenbenchmark.record. For example import timeit from fixtures.zenith_fixtures import ZenithEnv -pytest_plugins = ("fixtures.zenith_fixtures", "fixtures.benchmark_fixture") - def test_mybench(zenith_simple_env: env, zenbenchmark): # Initialize the test @@ -41,6 +39,8 @@ def test_mybench(zenith_simple_env: env, zenbenchmark): # Record another measurement zenbenchmark.record('speed_of_light', 300000, 'km/s') +There's no need to import this file to use it. It should be declared as a plugin +inside conftest.py, and that makes it available to all tests. You can measure multiple things in one test, and record each one with a separate call to zenbenchmark. For example, you could time the bulk loading that happens diff --git a/test_runner/fixtures/zenith_fixtures.py b/test_runner/fixtures/zenith_fixtures.py index 7859b0c314..cafae1b63a 100644 --- a/test_runner/fixtures/zenith_fixtures.py +++ b/test_runner/fixtures/zenith_fixtures.py @@ -45,9 +45,8 @@ the standard pytest.fixture with some extra behavior. There are several environment variables that can control the running of tests: ZENITH_BIN, POSTGRES_DISTRIB_DIR, etc. See README.md for more information. -To use fixtures in a test file, add this line of code: - ->>> pytest_plugins = ("fixtures.zenith_fixtures") +There's no need to import this file to use it. It should be declared as a plugin +inside conftest.py, and that makes it available to all tests. Don't import functions from this file, or pytest will emit warnings. Instead put directly-importable functions into utils.py or another separate file. diff --git a/test_runner/performance/test_bulk_insert.py b/test_runner/performance/test_bulk_insert.py index ed9113cb02..4e73bedcc0 100644 --- a/test_runner/performance/test_bulk_insert.py +++ b/test_runner/performance/test_bulk_insert.py @@ -4,12 +4,6 @@ from fixtures.log_helper import log from fixtures.benchmark_fixture import MetricReport, ZenithBenchmarker from fixtures.compare_fixtures import PgCompare, VanillaCompare, ZenithCompare -pytest_plugins = ( - "fixtures.zenith_fixtures", - "fixtures.benchmark_fixture", - "fixtures.compare_fixtures", -) - # # Run bulk INSERT test. diff --git a/test_runner/performance/test_bulk_tenant_create.py b/test_runner/performance/test_bulk_tenant_create.py index 16bdd2ef46..6fd77f3020 100644 --- a/test_runner/performance/test_bulk_tenant_create.py +++ b/test_runner/performance/test_bulk_tenant_create.py @@ -4,8 +4,6 @@ import pytest from fixtures.zenith_fixtures import ZenithEnvBuilder -pytest_plugins = ("fixtures.benchmark_fixture") - # Run bulk tenant creation test. # # Collects metrics: diff --git a/test_runner/performance/test_copy.py b/test_runner/performance/test_copy.py index 6b66d26433..e04a0361cb 100644 --- a/test_runner/performance/test_copy.py +++ b/test_runner/performance/test_copy.py @@ -6,12 +6,6 @@ from fixtures.compare_fixtures import PgCompare, VanillaCompare, ZenithCompare from io import BufferedReader, RawIOBase from itertools import repeat -pytest_plugins = ( - "fixtures.zenith_fixtures", - "fixtures.benchmark_fixture", - "fixtures.compare_fixtures", -) - class CopyTestData(RawIOBase): def __init__(self, rows: int): diff --git a/test_runner/performance/test_gist_build.py b/test_runner/performance/test_gist_build.py index 70600a4fff..92396f6cb7 100644 --- a/test_runner/performance/test_gist_build.py +++ b/test_runner/performance/test_gist_build.py @@ -5,12 +5,6 @@ from fixtures.zenith_fixtures import ZenithEnv from fixtures.compare_fixtures import PgCompare, VanillaCompare, ZenithCompare from fixtures.log_helper import log -pytest_plugins = ( - "fixtures.zenith_fixtures", - "fixtures.benchmark_fixture", - "fixtures.compare_fixtures", -) - # # Test buffering GisT build. It WAL-logs the whole relation, in 32-page chunks. diff --git a/test_runner/performance/test_parallel_copy_to.py b/test_runner/performance/test_parallel_copy_to.py index cdd40368e1..e4388ce8e2 100644 --- a/test_runner/performance/test_parallel_copy_to.py +++ b/test_runner/performance/test_parallel_copy_to.py @@ -6,12 +6,6 @@ from fixtures.log_helper import log from fixtures.benchmark_fixture import MetricReport, ZenithBenchmarker from fixtures.compare_fixtures import PgCompare, VanillaCompare, ZenithCompare -pytest_plugins = ( - "fixtures.zenith_fixtures", - "fixtures.benchmark_fixture", - "fixtures.compare_fixtures", -) - async def repeat_bytes(buf, repetitions: int): for i in range(repetitions): diff --git a/test_runner/performance/test_perf_pgbench.py b/test_runner/performance/test_perf_pgbench.py index 605e32cc4e..5ffce3c0be 100644 --- a/test_runner/performance/test_perf_pgbench.py +++ b/test_runner/performance/test_perf_pgbench.py @@ -5,12 +5,6 @@ from fixtures.compare_fixtures import PgCompare, VanillaCompare, ZenithCompare from fixtures.benchmark_fixture import MetricReport, ZenithBenchmarker from fixtures.log_helper import log -pytest_plugins = ( - "fixtures.zenith_fixtures", - "fixtures.benchmark_fixture", - "fixtures.compare_fixtures", -) - # # Run a very short pgbench test. diff --git a/test_runner/performance/test_perf_pgbench_remote.py b/test_runner/performance/test_perf_pgbench_remote.py index 6d495ef371..28472a16c8 100644 --- a/test_runner/performance/test_perf_pgbench_remote.py +++ b/test_runner/performance/test_perf_pgbench_remote.py @@ -9,8 +9,6 @@ import calendar import timeit import os -pytest_plugins = ("fixtures.benchmark_fixture", ) - def utc_now_timestamp() -> int: return calendar.timegm(datetime.utcnow().utctimetuple()) diff --git a/test_runner/performance/test_small_seqscans.py b/test_runner/performance/test_small_seqscans.py index ec662ce81f..b98018ad97 100644 --- a/test_runner/performance/test_small_seqscans.py +++ b/test_runner/performance/test_small_seqscans.py @@ -11,12 +11,6 @@ from fixtures.benchmark_fixture import MetricReport, ZenithBenchmarker from fixtures.compare_fixtures import PgCompare import pytest -pytest_plugins = ( - "fixtures.zenith_fixtures", - "fixtures.benchmark_fixture", - "fixtures.compare_fixtures", -) - @pytest.mark.parametrize('rows', [ pytest.param(100000), diff --git a/test_runner/performance/test_write_amplification.py b/test_runner/performance/test_write_amplification.py index bf58cf8274..49232bf6d3 100644 --- a/test_runner/performance/test_write_amplification.py +++ b/test_runner/performance/test_write_amplification.py @@ -17,12 +17,6 @@ from fixtures.zenith_fixtures import ZenithEnv from fixtures.compare_fixtures import PgCompare, VanillaCompare, ZenithCompare from fixtures.log_helper import log -pytest_plugins = ( - "fixtures.zenith_fixtures", - "fixtures.benchmark_fixture", - "fixtures.compare_fixtures", -) - def test_write_amplification(zenith_with_baseline: PgCompare): env = zenith_with_baseline diff --git a/test_runner/test_broken.py b/test_runner/test_broken.py index f8e5656a60..56c735e87c 100644 --- a/test_runner/test_broken.py +++ b/test_runner/test_broken.py @@ -3,8 +3,6 @@ import os from fixtures.zenith_fixtures import ZenithEnv from fixtures.log_helper import log - -pytest_plugins = ("fixtures.zenith_fixtures") """ Use this test to see what happens when tests fail.