summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrina Truong <i.chernyavska@gmail.com>2018-09-22 15:42:45 -0700
committerGitHub <noreply@github.com>2018-09-22 15:42:45 -0700
commit381869b72712310c05c5643dc89b7fe656e99255 (patch)
tree4275c185ad45ce09cd055bee7b39a117facd3182
parent7889b2838f8890122d0f9c4bc141e03cfc25d003 (diff)
parent741a3259539a61838bb001314ed32a3e4dc93a19 (diff)
Merge pull request #942 from dbcli/j-bennet/testing-experiments
Revert abs imports in tests.
-rw-r--r--tests/__init__.py0
-rw-r--r--tests/conftest.py6
-rw-r--r--tests/features/environment.py10
-rw-r--r--tests/features/fixture_utils.py9
-rw-r--r--tests/features/steps/auto_vertical.py4
-rw-r--r--tests/features/steps/basic_commands.py4
-rw-r--r--tests/features/steps/crud_database.py4
-rw-r--r--tests/features/steps/crud_table.py4
-rw-r--r--tests/features/steps/expanded.py4
-rw-r--r--tests/features/steps/iocommands.py4
-rw-r--r--tests/features/steps/named_queries.py4
-rw-r--r--tests/features/steps/specials.py4
-rw-r--r--tests/test_main.py4
-rw-r--r--tests/test_pgexecute.py4
-rw-r--r--tests/test_smart_completion_multiple_schemata.py4
-rw-r--r--tests/test_smart_completion_public_schema_only.py4
16 files changed, 37 insertions, 36 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/tests/__init__.py
+++ /dev/null
diff --git a/tests/conftest.py b/tests/conftest.py
index c0b666f2..9554623a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,9 +1,9 @@
-from __future__ import print_function, absolute_import
+from __future__ import print_function
import os
import pytest
-from tests.utils import (POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD, create_db, db_connection,
- drop_tables)
+from utils import (POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD, create_db, db_connection,
+ drop_tables)
import pgcli.pgexecute
diff --git a/tests/features/environment.py b/tests/features/environment.py
index 71da011a..cab88b7d 100644
--- a/tests/features/environment.py
+++ b/tests/features/environment.py
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
import copy
import os
import sys
-import tests.features.db_utils as dbutils
-import tests.features.fixture_utils as fixutils
+import db_utils as dbutils
+import fixture_utils as fixutils
import pexpect
import tempfile
import shutil
-from tests.features.steps import wrappers
+from steps import wrappers
def before_all(context):
@@ -102,7 +102,7 @@ def before_all(context):
context.conf['pass'], context.conf['dbname'],
context.conf['port'])
- context.fixture_data = fixutils.read_fixture_files(fixture_dir)
+ context.fixture_data = fixutils.read_fixture_files()
# use temporary directory as config home
context.env_config_home = tempfile.mkdtemp(prefix='pgcli_home_')
diff --git a/tests/features/fixture_utils.py b/tests/features/fixture_utils.py
index dcc09db4..af10596a 100644
--- a/tests/features/fixture_utils.py
+++ b/tests/features/fixture_utils.py
@@ -18,10 +18,11 @@ def read_fixture_lines(filename):
return lines
-def read_fixture_files(fixture_dir):
- """
- Read all files inside fixture_data directory.
- """
+def read_fixture_files():
+ """Read all files inside fixture_data directory."""
+ current_dir = os.path.dirname(__file__)
+ fixture_dir = os.path.join(current_dir, 'fixture_data/')
+ print('reading fixture data: {}'.format(fixture_dir))
fixture_dict = {}
for filename in os.listdir(fixture_dir):
if filename not in ['.', '..']:
diff --git a/tests/features/steps/auto_vertical.py b/tests/features/steps/auto_vertical.py
index 77487536..18a51faf 100644
--- a/tests/features/steps/auto_vertical.py
+++ b/tests/features/steps/auto_vertical.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
from textwrap import dedent
from behave import then, when
-from tests.features.steps import wrappers
+import wrappers
@when('we run dbcli with {arg}')
diff --git a/tests/features/steps/basic_commands.py b/tests/features/steps/basic_commands.py
index 154881fb..9bafb61d 100644
--- a/tests/features/steps/basic_commands.py
+++ b/tests/features/steps/basic_commands.py
@@ -4,13 +4,13 @@ Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it.
This string is used to call the step in "*.feature" file.
"""
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
import tempfile
from behave import when, then
from textwrap import dedent
-from tests.features.steps import wrappers
+import wrappers
@when('we run dbcli')
diff --git a/tests/features/steps/crud_database.py b/tests/features/steps/crud_database.py
index a46f53bc..4d692c6d 100644
--- a/tests/features/steps/crud_database.py
+++ b/tests/features/steps/crud_database.py
@@ -4,12 +4,12 @@ Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it.
This string is used to call the step in "*.feature" file.
"""
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
import pexpect
from behave import when, then
-from tests.features.steps import wrappers
+import wrappers
@when('we create database')
diff --git a/tests/features/steps/crud_table.py b/tests/features/steps/crud_table.py
index 4dad0703..b8ec0d59 100644
--- a/tests/features/steps/crud_table.py
+++ b/tests/features/steps/crud_table.py
@@ -4,11 +4,11 @@ Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it.
This string is used to call the step in "*.feature" file.
"""
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
from behave import when, then
from textwrap import dedent
-from tests.features.steps import wrappers
+import wrappers
@when('we create table')
diff --git a/tests/features/steps/expanded.py b/tests/features/steps/expanded.py
index 6e1af6c0..cee34814 100644
--- a/tests/features/steps/expanded.py
+++ b/tests/features/steps/expanded.py
@@ -5,11 +5,11 @@ Each step is defined by the string decorating it. This string is used
to call the step in "*.feature" file.
"""
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
from behave import when, then
from textwrap import dedent
-from tests.features.steps import wrappers
+import wrappers
@when('we prepare the test data')
diff --git a/tests/features/steps/iocommands.py b/tests/features/steps/iocommands.py
index b3954a83..95bf8652 100644
--- a/tests/features/steps/iocommands.py
+++ b/tests/features/steps/iocommands.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
import os
import os.path
from behave import when, then
-from tests.features.steps import wrappers
+import wrappers
@when('we start external editor providing a file name')
diff --git a/tests/features/steps/named_queries.py b/tests/features/steps/named_queries.py
index 57be08b0..d60947ff 100644
--- a/tests/features/steps/named_queries.py
+++ b/tests/features/steps/named_queries.py
@@ -4,10 +4,10 @@ Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it.
This string is used to call the step in "*.feature" file.
"""
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
from behave import when, then
-from tests.features.steps import wrappers
+import wrappers
@when('we save a named query')
diff --git a/tests/features/steps/specials.py b/tests/features/steps/specials.py
index 268c531e..26450514 100644
--- a/tests/features/steps/specials.py
+++ b/tests/features/steps/specials.py
@@ -4,10 +4,10 @@ Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it.
This string is used to call the step in "*.feature" file.
"""
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
from behave import when, then
-from tests.features.steps import wrappers
+import wrappers
@when('we refresh completions')
diff --git a/tests/test_main.py b/tests/test_main.py
index 7d6d773e..69cc5d76 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -1,5 +1,5 @@
# coding=utf-8
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
import os
import platform
import mock
@@ -14,7 +14,7 @@ from pgcli.main import (
obfuscate_process_password, format_output, PGCli, OutputSettings
)
from pgspecial.main import (PAGER_OFF, PAGER_LONG_OUTPUT, PAGER_ALWAYS)
-from tests.utils import dbtest, run
+from utils import dbtest, run
from collections import namedtuple
diff --git a/tests/test_pgexecute.py b/tests/test_pgexecute.py
index 3644a020..559ac5a3 100644
--- a/tests/test_pgexecute.py
+++ b/tests/test_pgexecute.py
@@ -1,12 +1,12 @@
# coding=UTF-8
-from __future__ import print_function, absolute_import
+from __future__ import print_function
import pytest
import psycopg2
from mock import patch
from pgcli.packages.parseutils.meta import FunctionMetadata
from textwrap import dedent
-from tests.utils import run, dbtest, requires_json, requires_jsonb
+from utils import run, dbtest, requires_json, requires_jsonb
from pgcli.main import PGCli
diff --git a/tests/test_smart_completion_multiple_schemata.py b/tests/test_smart_completion_multiple_schemata.py
index 49aee7cf..fd92c373 100644
--- a/tests/test_smart_completion_multiple_schemata.py
+++ b/tests/test_smart_completion_multiple_schemata.py
@@ -1,7 +1,7 @@
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
import itertools
-from tests.metadata import (MetaData, alias, name_join, fk_join, join,
+from metadata import (MetaData, alias, name_join, fk_join, join,
schema, table, function, wildcard_expansion, column,
get_result, result_set, qual, no_qual, parametrize)
diff --git a/tests/test_smart_completion_public_schema_only.py b/tests/test_smart_completion_public_schema_only.py
index 93a55a95..76424610 100644
--- a/tests/test_smart_completion_public_schema_only.py
+++ b/tests/test_smart_completion_public_schema_only.py
@@ -1,6 +1,6 @@
-from __future__ import unicode_literals, print_function, absolute_import
+from __future__ import unicode_literals, print_function
-from tests.metadata import (MetaData, alias, name_join, fk_join, join, keyword,
+from metadata import (MetaData, alias, name_join, fk_join, join, keyword,
schema, table, view, function, column, wildcard_expansion,
get_result, result_set, qual, no_qual, parametrize)
from prompt_toolkit.completion import Completion