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

build(ci): add and use editable tox factor #467

Merged
merged 7 commits into from
Sep 26, 2021
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- tox_env: "py39-ipython-coverage"
python: "3.9"
os: ubuntu-20.04
- tox_env: "py38-coverage"
- tox_env: "py38-editable-coverage"
python: "3.8"
os: ubuntu-20.04
- tox_env: "py37-coverage"
Expand Down
8 changes: 8 additions & 0 deletions testing/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import functools
import os
import sys
import sysconfig
from contextlib import contextmanager

import pytest
Expand Down Expand Up @@ -194,3 +196,9 @@ def import_mock(name, *args):
m.setattr('__builtin__.__import__', import_mock)
yield m
return cm


def skip_with_missing_pth_file():
pth = os.path.join(sysconfig.get_path("purelib"), "pdbpp_hijack_pdb.pth")
if not os.path.exists(pth):
pytest.skip("Missing pth file ({}), editable install?".format(pth))
6 changes: 5 additions & 1 deletion testing/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import pytest

from .conftest import skip_with_missing_pth_file


def test_integration(testdir, readline_param):
tmpdir = testdir.tmpdir

f = tmpdir.ensure("test_file.py")
f.write("print('before'); __import__('pdb').set_trace(); print('after')")
f.write("print('before'); __import__('pdbpp').set_trace(); print('after')")

if readline_param != "pyrepl":
# Create empty pyrepl module to ignore any installed pyrepl.
Expand Down Expand Up @@ -70,6 +72,8 @@ def test_ipython(testdir):
- `up` used to crash due to conflicting `hidden_frames` attribute/method.
"""
pytest.importorskip("IPython")
skip_with_missing_pth_file()

child = testdir.spawn(
"{} -m IPython --colors=nocolor --simple-prompt".format(
sys.executable,
Expand Down
13 changes: 5 additions & 8 deletions testing/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
import traceback
from io import BytesIO

import pdbpp
import py
import pytest

import pdbpp
from pdbpp import DefaultConfig, Pdb, StringIO

from .conftest import skip_with_missing_pth_file

try:
from shlex import quote
except ImportError:
Expand Down Expand Up @@ -4304,12 +4305,8 @@ def test_python_m_pdb_usage():

@pytest.mark.parametrize('PDBPP_HIJACK_PDB', (1, 0))
def test_python_m_pdb_uses_pdbpp_and_env(PDBPP_HIJACK_PDB, monkeypatch, tmpdir):
from sysconfig import get_path

if PDBPP_HIJACK_PDB:
pth = os.path.join(get_path("purelib"), "pdbpp_hijack_pdb.pth")
if not os.path.exists(pth):
pytest.skip("Missing pth file ({}), editable install?".format(pth))
skip_with_missing_pth_file()

monkeypatch.setenv("PDBPP_HIJACK_PDB", str(PDBPP_HIJACK_PDB))

Expand Down Expand Up @@ -4788,7 +4785,7 @@ def inner():

def outer():
completeme_outer = 2
__import__('pdb').set_trace()
__import__('pdbpp').set_trace()

outer()
"""
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ passenv =
PYTEST_ADDOPTS
PY_COLORS
TERM
usedevelop =
editable: True
commands = pytest {posargs}

[testenv:checkqa]
Expand Down