From e6e26d558f600c73a1964c906b80622bd735885d Mon Sep 17 00:00:00 2001 From: Irina Truong Date: Sat, 22 Sep 2018 22:19:25 +0000 Subject: Revert abs imports in tests. --- tests/__init__.py | 0 tests/conftest.py | 6 +++--- tests/features/environment.py | 10 +++++----- tests/features/fixture_utils.py | 5 ++++- tests/features/steps/auto_vertical.py | 4 ++-- tests/features/steps/basic_commands.py | 4 ++-- tests/features/steps/crud_database.py | 4 ++-- tests/features/steps/crud_table.py | 4 ++-- tests/features/steps/expanded.py | 4 ++-- tests/features/steps/iocommands.py | 4 ++-- tests/features/steps/named_queries.py | 4 ++-- tests/features/steps/specials.py | 4 ++-- tests/test_main.py | 4 ++-- tests/test_pgexecute.py | 4 ++-- tests/test_smart_completion_multiple_schemata.py | 4 ++-- tests/test_smart_completion_public_schema_only.py | 4 ++-- 16 files changed, 36 insertions(+), 33 deletions(-) delete mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 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..31efb3a8 100644 --- a/tests/features/fixture_utils.py +++ b/tests/features/fixture_utils.py @@ -18,10 +18,13 @@ def read_fixture_lines(filename): return lines -def read_fixture_files(fixture_dir): +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 -- cgit v1.2.3 From 741a3259539a61838bb001314ed32a3e4dc93a19 Mon Sep 17 00:00:00 2001 From: Irina Truong Date: Sat, 22 Sep 2018 22:34:00 +0000 Subject: pep8 --- tests/features/fixture_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/features/fixture_utils.py b/tests/features/fixture_utils.py index 31efb3a8..af10596a 100644 --- a/tests/features/fixture_utils.py +++ b/tests/features/fixture_utils.py @@ -19,9 +19,7 @@ def read_fixture_lines(filename): def read_fixture_files(): - """ - Read all files inside fixture_data directory. - """ + """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)) -- cgit v1.2.3