Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for PyCharm test debugging, and add tox environment setup #5189

Merged
merged 8 commits into from Jun 14, 2018
Copy path View file
@@ -19,6 +19,7 @@ dmypy.json
# Packages
*.egg
*.egg-info
*.eggs

# IDEs
.idea
@@ -33,3 +34,5 @@ htmlcov

# pytest cache
.pytest_cache/

.tox
Copy path View file
@@ -58,6 +58,13 @@ def test_python_cmdline(testcase: DataDrivenTestCase) -> None:
outb = process.stdout.read()
# Split output into lines.
out = [s.rstrip('\n\r') for s in str(outb, 'utf8').splitlines()]

if "PYCHARM_HOSTED" in os.environ:
pos = next((p for p, i in enumerate(out) if i.startswith('pydev debugger: ')), None)
if pos is not None:
del out[pos] # the attaching debugger message itself
del out[pos] # plus the extra new line added

This comment has been minimized.

Copy link
@ilevkivskyi

ilevkivskyi Jun 14, 2018

Collaborator

This code looks quite fragile (what if the debugger output format changes?). Is it possible to configure the debugger to just not print these lines?

This comment has been minimized.

Copy link
@ilevkivskyi

ilevkivskyi Jun 14, 2018

Collaborator

Also please don't rebase your PR, merge when needed, otherwise it is hard to follow.

This comment has been minimized.

Copy link
@gaborbernat

gaborbernat Jun 14, 2018

Author Contributor

we'll need to follow up then and amend it; I haven't found a way to disable it sadly 😢

This comment has been minimized.

Copy link
@ilevkivskyi

ilevkivskyi Jun 14, 2018

Collaborator

OK.


result = process.wait()
# Remove temp file.
os.remove(program_path)
Copy path View file
@@ -20,4 +20,5 @@ python_classes =
python_functions =

# always run in parallel (requires pytest-xdist, see test-requirements.txt)
addopts = -nauto --cov-append --cov-report=
addopts = -nauto

Copy path View file
@@ -25,7 +25,8 @@ exclude =
typeshed/*,
# during runtests.py flake8 might be started when there's still examples in the temp dir
tmp-test-dirs/*

.tox
.eggs

# Things to ignore:
# E251: spaces around default arg value (against our style)
Copy path View file
40 tox.ini
@@ -0,0 +1,40 @@
[tox]
minversion = 2.9.1
skip_missing_interpreters = true
envlist = py34,
py35,
py36,
py37,
lint,
type,
docs

[testenv]
description = run the test driver with {basepython}
deps = -rtest-requirements.txt
commands = python runtests.py -x lint -x self-check {posargs}

[testenv:lint]
description = check the code style
basepython = python3.6
commands = python runtests.py lint {posargs}

[testenv:type]
description = type check ourselves
basepython = python3.6
commands = python runtests.py self-check -p '-n0' -p '-v'

[testenv:docs]
description = invoke sphinx-build to build the HTML docs
basepython = python3.6
deps = -rdocs/requirements-docs.txt
commands = sphinx-build -d "{toxworkdir}/docs_doctree" docs/source "{toxworkdir}/docs_out" --color -W -bhtml {posargs}

[testenv:dev]
description = generate a DEV environment, that has all project libraries
usedevelop = True
basepython = python3.6
deps = -rtest-requirements.txt
-rdocs/requirements-docs.txt
commands = python -m pip list --format=columns
python -c 'import sys; print(sys.executable)'
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.