Skip to content

Commit

Permalink
Do not use psycopg2 to set default parameter value
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Feb 19, 2021
1 parent 18067fb commit a8c84fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/pytest_postgresql/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import platform
import subprocess
from tempfile import gettempdir
from typing import List, Callable, Union, Iterable
from typing import List, Callable, Union, Iterable, Optional
from warnings import warn

import pytest
Expand Down Expand Up @@ -216,7 +216,7 @@ def postgresql_noproc_fixture(request: FixtureRequest) -> NoopExecutor:

def postgresql(
process_fixture_name: str, db_name: str = None, load: List[str] = None,
isolation_level: int = psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT,
isolation_level: Optional[int] = None,
) -> Callable[[FixtureRequest], connection]:
"""
Return connection fixture factory for PostgreSQL.
Expand All @@ -225,7 +225,6 @@ def postgresql(
:param db_name: database name
:param load: SQL to automatically load into our test database
:param isolation_level: optional postgresql isolation level
defaults to ISOLATION_LEVEL_AUTOCOMMIT
:returns: function which makes a connection to postgresql
"""

Expand Down
4 changes: 2 additions & 2 deletions src/pytest_postgresql/janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(
db_name: str,
version: Union[str, float, Version],
password: str = None,
isolation_level: int = psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT,
isolation_level: Optional[int] = None,
) -> None:
"""
Initialize janitor.
Expand All @@ -43,7 +43,7 @@ def __init__(
self.host = host
self.port = port
self.db_name = db_name
self.isolation_level = isolation_level
self.isolation_level = isolation_level or psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT
if not isinstance(version, Version):
self.version = parse_version(str(version))
else:
Expand Down

0 comments on commit a8c84fe

Please sign in to comment.