Skip to content

Commit e8e6bb4

Browse files
authored
Merge pull request dbcli#431 from dbcli/tsroten/clean_up_config
Clean up testing config files.
2 parents 5f9d916 + c606deb commit e8e6bb4

11 files changed

+36
-31
lines changed

.coveragerc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[run]
2-
parallel=True
3-
source=mycli
2+
parallel = True
3+
source = mycli

.travis.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ python:
77
- "3.6"
88

99
install:
10-
- pip install PyMySQL . pytest mock codecov pexpect behave
10+
- pip install PyMySQL pytest mock codecov pexpect behave pytest-cov
1111
- pip install git+https://github.com/hayd/pep8radius.git
12+
- pip install -e .
1213

1314
script:
1415
- set -e
15-
- coverage run --source mycli -m py.test
16-
- cd test
17-
- behave
18-
- cd ..
16+
- py.test --cov-report= --cov=mycli
17+
- behave test/features
1918
# check for pep8 errors, only looking at branch vs master. If there are errors, show diff and return an error code.
2019
- pep8radius master --docformatter --error-status || ( pep8radius master --docformatter --diff; false )
2120
- set +e
@@ -30,4 +29,3 @@ notifications:
3029
- YOUR_WEBHOOK_URL
3130
on_success: change # options: [always|never|change] default: always
3231
on_failure: always # options: [always|never|change] default: always
33-
on_start: false # default: false

MANIFEST.in

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
include LICENSE.txt *.md *.rst requirements-dev.txt screenshots/*
2-
include conftest.py .coveragerc pytest.ini test tox.ini
2+
include .coveragerc tox.ini
3+
recursive-include test *.cnf
4+
recursive-include test *.feature
5+
recursive-include test *.py
6+
recursive-include test *.txt

conftest.py

-13
This file was deleted.

mycli/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
# Query tuples are used for maintaining history
5757
Query = namedtuple('Query', ['query', 'successful', 'mutating'])
5858

59-
PACKAGE_ROOT = os.path.dirname(__file__)
59+
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
6060

6161
# no-op logging handler
6262
class NullHandler(logging.Handler):

pytest.ini

-2
This file was deleted.

requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
mock
22
pytest
3+
pytest-cov==2.4.0
34
tox
45
twine==1.8.1
56
behave

setup.cfg

+9
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
[bdist_wheel]
22
universal = 1
3+
4+
[tool:pytest]
5+
addopts = --capture=sys
6+
--showlocals
7+
--doctest-modules
8+
--ignore=setup.py
9+
--ignore=mycli/magic.py
10+
--ignore=mycli/packages/parseutils.py
11+
--ignore=test/features

test/features/environment.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ def before_all(context):
1616
os.environ['LINES'] = "100"
1717
os.environ['COLUMNS'] = "100"
1818
os.environ['EDITOR'] = 'ex'
19-
os.environ["COVERAGE_PROCESS_START"] = os.getcwd() + "/../.coveragerc"
19+
20+
context.package_root = os.path.abspath(
21+
os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
22+
23+
os.environ["COVERAGE_PROCESS_START"] = os.path.join(context.package_root,
24+
'.coveragerc')
2025

2126
context.exit_sent = False
2227

@@ -48,7 +53,9 @@ def before_all(context):
4853
'pager_boundary': '---boundary---',
4954
}
5055
os.environ['PAGER'] = "{0} {1} {2}".format(
51-
sys.executable, "test/features/wrappager.py", context.conf['pager_boundary'])
56+
sys.executable,
57+
os.path.join(context.package_root, 'test/features/wrappager.py'),
58+
context.conf['pager_boundary'])
5259

5360
context.cn = dbutils.create_db(context.conf['host'], context.conf['user'],
5461
context.conf['pass'],

test/features/steps/iocommands.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
@when('we start external editor providing a file name')
1111
def step_edit_file(context):
1212
"""Edit file with external editor."""
13-
context.editor_file_name = '../test_file_{0}.sql'.format(
14-
context.conf['vi'])
13+
context.editor_file_name = os.path.join(
14+
context.package_root, 'test_file_{0}.sql'.format(context.conf['vi']))
1515
if os.path.exists(context.editor_file_name):
1616
os.remove(context.editor_file_name)
1717
context.cli.sendline('\e {0}'.format(
@@ -48,7 +48,8 @@ def step_edit_done_sql(context):
4848

4949
@when(u'we tee output')
5050
def step_tee_ouptut(context):
51-
context.tee_file_name = '../tee_file_{0}.sql'.format(context.conf['vi'])
51+
context.tee_file_name = os.path.join(
52+
context.package_root, 'tee_file_{0}.sql'.format(context.conf['vi']))
5253
if os.path.exists(context.tee_file_name):
5354
os.remove(context.tee_file_name)
5455
context.cli.sendline('tee {0}'.format(

test/features/steps/wrappers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def run_cli(context):
3838

3939
cmd_parts = [cli_cmd] + run_args
4040
cmd = ' '.join(cmd_parts)
41-
context.cli = pexpect.spawnu(cmd, cwd='..')
41+
context.cli = pexpect.spawnu(cmd, cwd=context.package_root)
4242
context.exit_sent = False
4343
context.currentdb = context.conf['dbname']
4444

0 commit comments

Comments
 (0)