Skip to content

Commit

Permalink
Code review cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Nov 7, 2024
1 parent 8b9d68d commit 729d6ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions test_runner/fixtures/pg_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,17 @@ def _missing_(cls, value: object) -> PgVersion | None:
if not isinstance(value, str):
return None

known_values = {v.value for _, v in cls.__members__.items()}
known_values = set(cls.__members__.values())

# Allow passing version as v-prefixed string (e.g. "v14")
if value.lower().startswith("v") and (v := value[1:]) in known_values:
return cls(v)

# Allow passing version as an int (i.e. both "15" and "150002" matches PgVersion.V15)
elif value.isdigit() and (v := value[:2]) in known_values:
if value.isdigit() and (v := value[:2]) in known_values:
return cls(v)
else:
return None

return None


DEFAULT_VERSION: PgVersion = PgVersion.V16
Expand Down
2 changes: 1 addition & 1 deletion test_runner/performance/test_physical_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def test_replication_start_stop(
],
env=master_env,
)
replica_pgbench: list[subprocess.Popen[Any] | None] = [None for _ in range(num_replicas)]
replica_pgbench: list[subprocess.Popen[Any] | None] = [None] * num_replicas

# Use the bits of iconfig to tell us which configuration we are on. For example
# a iconfig of 2 is 10 in binary, indicating replica 0 is suspended and replica 1 is
Expand Down

0 comments on commit 729d6ed

Please sign in to comment.