Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile--std-all.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ ENV PYTHON_VERSION=3
# --------------------------------------------- final
FROM base2_with_python-${PYTHON_VERSION} as final

# it is required for getting external packages
RUN apk add --no-cache git

#RUN apk add --no-cache mc

# Full version of "ps" command
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile--std.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ ENV PYTHON_VERSION=3
# --------------------------------------------- final
FROM base2_with_python-${PYTHON_VERSION} as final

# it is required for getting external packages
RUN apk add --no-cache git

ENV LANG=C.UTF-8

ADD . /pg/testgres
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile--ubuntu_24_04.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ ENV PYTHON_VERSION=3
# --------------------------------------------- final
FROM base2_with_python-${PYTHON_VERSION} as final

# it is required for getting external packages
RUN apt install -y git

ADD . /pg/testgres
WORKDIR /pg/testgres
RUN chown -R postgres /pg
Expand Down
1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@pip install --force-reinstall ..
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
12 changes: 10 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
import testgres

assert testgres.__path__ is not None
assert len(testgres.__path__) == 1
assert type(testgres.__path__[0] == str) # noqa: E721
p = os.path.dirname(testgres.__path__[0])
assert type(p) == str # noqa: E721
sys.path.insert(0, os.path.abspath(p))

# -- Project information -----------------------------------------------------

project = u'testgres'
package_name = u'testgres'
copyright = u'2016-2023, Postgres Professional'
author = u'Postgres Professional'

Expand Down Expand Up @@ -55,7 +63,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,19 @@
if sys.version_info < (3, 3):
install_requires.append("ipaddress")

install_requires.append(
"testgres.os_ops @ git+https://github.com/postgrespro/testgres.os_ops.git"
)

# Get contents of README file
with open('README.md', 'r') as f:
readme = f.read()

setup(
version='1.11.1',
name='testgres',
packages=['testgres', 'testgres.operations', 'testgres.impl'],
packages=['testgres', 'testgres.impl'],
package_dir={"testgres": "src"},
description='Testing utility for PostgreSQL and its extensions',
url='https://github.com/postgrespro/testgres',
long_description=readme,
Expand Down
6 changes: 3 additions & 3 deletions testgres/__init__.py → src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@

from .config import testgres_config

from .operations.os_ops import OsOperations, ConnectionParams
from .operations.local_ops import LocalOperations
from .operations.remote_ops import RemoteOperations
from testgres.operations.os_ops import OsOperations, ConnectionParams
from testgres.operations.local_ops import LocalOperations
from testgres.operations.remote_ops import RemoteOperations

__all__ = [
"get_new_node",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion testgres/backup.py → src/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from .exceptions import BackupException

from .operations.os_ops import OsOperations
from testgres.operations.os_ops import OsOperations

from .utils import \
get_bin_path2, \
Expand Down
4 changes: 2 additions & 2 deletions testgres/cache.py → src/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
get_bin_path2, \
execute_utility2

from .operations.local_ops import LocalOperations
from .operations.os_ops import OsOperations
from testgres.operations.local_ops import LocalOperations
from testgres.operations.os_ops import OsOperations


def cached_initdb(data_dir, logfile=None, params=None, os_ops: OsOperations = None, bin_path=None, cached=True):
Expand Down
4 changes: 2 additions & 2 deletions testgres/config.py → src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from contextlib import contextmanager

from .consts import TMP_CACHE
from .operations.os_ops import OsOperations
from .operations.local_ops import LocalOperations
from testgres.operations.os_ops import OsOperations
from testgres.operations.local_ops import LocalOperations

log_level = os.getenv('LOGGING_LEVEL', 'WARNING').upper()
log_format = os.getenv('LOGGING_FORMAT', '%(asctime)s - %(levelname)s - %(message)s')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
71 changes: 71 additions & 0 deletions src/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# coding: utf-8

import six

from testgres.operations.exceptions import TestgresException
from testgres.operations.exceptions import ExecUtilException
from testgres.operations.exceptions import InvalidOperationException


class PortForException(TestgresException):
pass


@six.python_2_unicode_compatible
class QueryException(TestgresException):
def __init__(self, message=None, query=None):
super(QueryException, self).__init__(message)

self.message = message
self.query = query

def __str__(self):
msg = []

if self.message:
msg.append(self.message)

if self.query:
msg.append(u'Query: {}'.format(self.query))

return six.text_type('\n').join(msg)


class TimeoutException(QueryException):
pass


class CatchUpException(QueryException):
pass


@six.python_2_unicode_compatible
class StartNodeException(TestgresException):
def __init__(self, message=None, files=None):
super(StartNodeException, self).__init__(message)

self.message = message
self.files = files

def __str__(self):
msg = []

if self.message:
msg.append(self.message)

for f, lines in self.files or []:
msg.append(u'{}\n----\n{}\n'.format(f, lines))

return six.text_type('\n').join(msg)


class InitNodeException(TestgresException):
pass


class BackupException(TestgresException):
pass


assert ExecUtilException.__name__ == "ExecUtilException"
assert InvalidOperationException.__name__ == "InvalidOperationException"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ..operations.os_ops import OsOperations
from testgres.operations.os_ops import OsOperations

from ..port_manager import PortManager
from ..exceptions import PortForException
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions testgres/node.py → src/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@

from .backup import NodeBackup

from .operations.os_ops import ConnectionParams
from .operations.os_ops import OsOperations
from .operations.local_ops import LocalOperations
from testgres.operations.os_ops import ConnectionParams
from testgres.operations.os_ops import OsOperations
from testgres.operations.local_ops import LocalOperations

InternalError = pglib.InternalError
ProgrammingError = pglib.ProgrammingError
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions testgres/utils.py → src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

from .exceptions import ExecUtilException
from .config import testgres_config as tconf
from .operations.os_ops import OsOperations
from .operations.remote_ops import RemoteOperations
from .operations.local_ops import LocalOperations
from .operations.helpers import Helpers as OsHelpers
from testgres.operations.os_ops import OsOperations
from testgres.operations.remote_ops import RemoteOperations
from testgres.operations.local_ops import LocalOperations
from testgres.operations.helpers import Helpers as OsHelpers

from .impl.port_manager__generic import PortManager__Generic

Expand Down
Empty file removed testgres/operations/__init__.py
Empty file.
55 changes: 0 additions & 55 deletions testgres/operations/helpers.py

This file was deleted.

Loading