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

Debug test doesn't work with pandarallel #22443

Closed
ureyes84 opened this issue Nov 8, 2023 · 2 comments
Closed

Debug test doesn't work with pandarallel #22443

ureyes84 opened this issue Nov 8, 2023 · 2 comments
Assignees
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@ureyes84
Copy link

ureyes84 commented Nov 8, 2023

Type: Bug

Behaviour

Expected vs. Actual

"Debug test" works erratically whenever the test in question makes use of the pandarallel library by calling df.parallel_applymap(f) (instead of df.applymap(f):

  • The Test Results tab in the terminal prints
TypeError: Cannot read properties of null (reading 'testsuites')
  • The breakpoints are ignored and the execution of the test will continue.
  • The test history panel will show the test as aborted (gray circle)

The expected behavior is
"Debug test" should work with pandarallel or handle the error gracefully and providing an actionable error message.

Steps to reproduce:

  1. Install pandarallel==1.6.5 and pandas==2.1.2
  2. Write a function that uses df.parallel_applymap(f).
  3. Write a unit test that calls the function above.
  4. In vscode run that unit test in debug mode.
from pandarallel import pandarallel
import pandas as pd

def test_pandarallel():
    pandarallel.initialize(nb_workers=2)

    def f(n):
        return n+1

    df = pd.DataFrame.from_dict({
        "a": [1,2,3],
        "b": [-1,-2,-3]
    })
    new_df = df.apply(f)
    print(new_df)

    new_df = df.parallel_applymap(f)
    print(new_df)
    print("Test finishes before this line")

Test Results

Running tests (pytest): /path/to/test/my-repo/tests/test_pandarallel.py::test_pandarallel
Running test with arguments: --rootdir /path/to/test --override-ini junit_family=xunit1 --junit-xml=/var/folders/mj/1qwq28ks7_q9vwh81wrf00xr0000gn/T/tmp-15748HI9U6dVLkk2R.xml --capture no ./my-repo/tests/test_pandarallel.py::test_pandarallel
Current working directory: /path/to/test
Workspace directory: /path/to/test
Run completed, parsing output
Error while running tests: test_pandarallel
TypeError: Cannot read properties of null (reading 'testsuites')

Error while running tests:
TypeError: Cannot read properties of null (reading 'testsuites')

Finished running tests!

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.18
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2023-11-08 12:59:53.607 [info] Using launch configuration in launch.json file.
2023-11-08 12:59:53.672 [info] DAP Server launched with command: /Users/my-username/Library/Caches/pypoetry/virtualenvs/my-repo-K11tsAIm-py3.9/bin/python /Users/my-username/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter
2023-11-08 12:59:58.138 [info] Connecting to DAP Server at:  127.0.0.1:62398
2023-11-08 12:59:58.275 [info] Connecting to DAP Server at:  127.0.0.1:62398
2023-11-08 12:59:58.315 [info] Connecting to DAP Server at:  127.0.0.1:62398

User Settings


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

Extension version: 2023.20.0
VS Code version: Code 1.84.1 (Universal) (2b35e1e6d88f1ce073683991d1eff5284a32690f, 2023-11-06T12:37:18.666Z)
OS version: Darwin arm64 23.0.0
Modes:

System Info
Item Value
CPUs Apple M2 Max (12 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 2, 1, 1
Memory (System) 32.00GB (6.69GB free)
Process Argv --crash-reporter-id 28c53b0d-dda6-4e78-9181-8a56964e4809
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263cf:30880073
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
3biah626:30602489
89544117:30613380
showlangstatbar:30737416
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixtcf:30871695
pythonregdiag2:30871582
pyreplss2:30879913
pythonmypyd1:30879173
pythoncet00cf:30874137
pythontbext0:30879054
dsvsc016cf:30880770
aa_t_chat:30882232

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Nov 8, 2023
@karthiknadig karthiknadig added triage-needed Needs assignment to the proper sub-team and removed triage-needed Needs assignment to the proper sub-team labels Nov 8, 2023
@karthiknadig
Copy link
Member

@ureyes84 Try adding this to your user settings and reload. We have a new experimental test runner that we think should handle this better:

"python.experiments.optInto": [
        "pythonTestAdapter"
    ],

@karthiknadig karthiknadig added area-testing info-needed Issue requires more information from poster labels Nov 8, 2023
Copy link

github-actions bot commented Dec 9, 2023

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

Happy Coding!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants