Skip to content

Commit

Permalink
Merge pull request #204 from Carreau/report-cleanup
Browse files Browse the repository at this point in the history
try to generate pytest-json-report to speedup timing
  • Loading branch information
Carreau authored Aug 2, 2022
2 parents a6b966d + 65c463c commit 3f4d593
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:

env:
DEBUG_TEST_PYFLYBY: 1
ENVNAME: ${{matrix.os}}-${{matrix.python-version}}

steps:
- uses: actions/checkout@v3
Expand All @@ -33,17 +34,33 @@ jobs:
if: ${{ matrix.python-version != '2.7'}}
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade "pexpect>=3.3" 'pytest<7' rlipython ipykernel==5.4.3 requests jupyter flaky 'notebook<6.1' 'prompt_toolkit<3.0.15' wheel 'jupyter_console>=6.2' 'pytest-cov<3' ipython 'coverage<6.3'
python -m pip install --upgrade "pexpect>=3.3" 'pytest<7' rlipython ipykernel==5.4.3 requests jupyter flaky 'notebook<6.1' 'prompt_toolkit<3.0.15' wheel 'jupyter_console>=6.2' 'pytest-cov<3' ipython 'coverage<6.3' pytest-json-report
pip install -e .
- name: test release build
run: |
python setup.py sdist bdist_wheel
- name: compileall
run: |
python -We:invalid -m compileall -f -q lib/ etc/;
- name: pytest
- name: pytest Python 2 or Mac OS
if: ${{ matrix.python-version == '2.7' || matrix.os == 'macos-latest'}}
# json report can't be installed on Py2, and make macos super slow.
run: |
python -m pytest --cov=pyflyby --cov-report=xml --doctest-modules --maxfail=3 lib tests
- name: pytest Python 3
if: ${{ matrix.python-version != '2.7' && matrix.os != 'macos-latest' }}
run: |
python -m pytest --cov=pyflyby --cov-report=xml\
--doctest-modules\
--maxfail=3\
--json-report\
--json-report-file=report-${ENVNAME}.json\
lib tests
- uses: actions/upload-artifact@v3
name: upload pytest timing reports as json
with:
path: |
./report-*.json
- uses: codecov/codecov-action@v2
- name: Build docs
if: ${{ matrix.python-version == '3.10'}}
Expand Down
16 changes: 16 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
coverage:
status:
project:
default:
threshold: 1%
target: 70%
patch:
default:
threshold: 1%
target: 0%
codecov:
notify:
after_n_builds: 6
comment:
require_changes: true # if true: only post the PR comment if coverage changes
after_n_builds: 6
37 changes: 35 additions & 2 deletions tests/test_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -4183,11 +4183,44 @@ def test_debug_postmortem_tab_completion_1(frontend):
""", frontend=frontend)


@pytest.mark.xfail(
@pytest.mark.skipif(
sys.version_info[0] == 2,
reason="[PYFLYBY] import base64 is not triggered at the same time depending on python versions",
)
def test_debug_namespace_1_py3(frontend):
# Verify that autoimporting and tab completion happen in the local
# namespace.
# In this example, in the local namespace, 'base64' is a variable (which
# is a string), and shouldn't refer to the global 'base64'.
ipython("""
In [1]: import pyflyby; pyflyby.enable_auto_importer()
In [2]: def foo(x, base64):
...: return x / base64
...:
In [3]: foo("Lexington", "atlantic")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
....
TypeError: unsupported operand type(s) for /: 'str' and 'str'
In [4]: %debug
....
ipdb> print(base64.cap\titalize() + b64deco\tde("UGFjaWZpYw==").decode('utf-8'))
[PYFLYBY] from base64 import b64decode
AtlanticPacific
ipdb> p b64deco\tde("Q29udGluZW50YWw=")
b'Continental'
ipdb> q
In [5]: base64.b64de\t
In [5]: base64.b64decode("SGlsbA==") + b64deco\tde("TGFrZQ==")
[PYFLYBY] from base64 import b64decode
Out[5]: b'HillLake'
""", frontend=frontend)

@pytest.mark.skipif(
sys.version_info[0] == 3,
reason="[PYFLYBY] import base64 is not triggered at the same time depending on python versions",
)
def test_debug_namespace_1(frontend):
def test_debug_namespace_1_py2(frontend):
# Verify that autoimporting and tab completion happen in the local
# namespace.
# In this example, in the local namespace, 'base64' is a variable (which
Expand Down

0 comments on commit 3f4d593

Please sign in to comment.