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

V2024.6.0 unable to test #23392

Closed
ljh740 opened this issue May 9, 2024 · 15 comments · Fixed by #23712
Closed

V2024.6.0 unable to test #23392

ljh740 opened this issue May 9, 2024 · 15 comments · Fixed by #23712
Assignees
Labels
area-testing author-verification-requested Issues potentially verifiable by issue author info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team verified Verification succeeded
Milestone

Comments

@ljh740
Copy link

ljh740 commented May 9, 2024

Type: Bug

Failed to import test module: test_foxe
Traceback (most recent call last):
  File "/*/versions/3.8.10/lib/python3.8/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/*/versions/3.8.10/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/***/test/test_foxe.py", line 9, in <module>
    from *** import ****
ModuleNotFoundError: No module named '****'

When I upgraded, I couldn't run the test cases properly.
All use cases cannot find modules in the superior directory.
Right now, I can only roll back to2024.4.1

Extension version: 2024.6.0
VS Code version: Code 1.89.0 (Universal) (b58957e67ee1e712cebf466b995adf4c5307b2bd, 2024-05-01T02:10:10.196Z)
OS version: Darwin arm64 23.4.0
Modes:

System Info
Item Value
CPUs Apple M1 (8 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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 11, 10, 13
Memory (System) 16.00GB (0.13GB free)
Process Argv --crash-reporter-id c7e92349-0709-40e0-b691-4c14fa71e224
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:31000449
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
ccp2r3:30993541
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
g316j359:31013175
pythoncenvpt:31022790
dwnewjupytercf:31035177

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label May 9, 2024
@karthiknadig
Copy link
Member

@ljh740 Can you provide more details on how your project is structured? If possible provide a minimal repro.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label May 9, 2024
@ljh740
Copy link
Author

ljh740 commented May 9, 2024

@ljh740 Can you provide more details on how your project is structured? If possible provide a minimal repro.

MRE here.it can work in 2024.4.1.but 2024.6.0 can`t.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label May 9, 2024
@ljh740
Copy link
Author

ljh740 commented May 28, 2024

@eleanorjboyd @karthiknadig Any progress?

@jbadger3
Copy link

Same problem on one of my own projects. Will look into adding a minimal repo link to help debug. Reverting to v2024.4.1 for now.

@eleanorjboyd
Copy link
Member

Hi! Could someone include logs or a minimal repro? This would help us narrow down what the issue might be- thanks!

@github-actions github-actions bot added the info-needed Issue requires more information from poster label May 31, 2024
@karthiknadig
Copy link
Member

@eleanorjboyd here is the minimal repro https://github.com/ljh740/pymre

@eleanorjboyd
Copy link
Member

Hi! Just gave it a try on my machine and the minimal repro sent works on both insiders and vscode stable. To confirm this error happens when you run the test? I was able to discover and run the test in the UI.

Follow up question then, can you send your version of python? From the first bug report I see python3.8 being used- do the rest of you have this version? Secondly can you send the full or more logs? I am specifically wondering if the rewrite experiment is on. You can check for it by looking for Experiment 'pythonTestAdapter' is active in your python logs. If not can you please turn it on and let me know if the behavior changes? You can do so adding this setting to your users settings.json "python.experiments.optInto": ["pythonTestAdapter"]. If you are unable to see the log for the experiment chance your log level to info or trace and it should show up (change log level through going to command palette and select developer set log level. Thanks!

@dobin
Copy link

dobin commented Jun 2, 2024

I have the same issue. Python unittest tests suddenly stopped working. No changes in code or config.

They work from command line:
image

But not from VSC:
image

Windows 10, Python 3.11.

024-05-29 09:05:07.846 [info] Experiment 'pythonCreateEnvOnPipInstallcf' is active
2024-05-29 09:05:07.846 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-05-29 09:05:07.846 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-05-29 09:05:07.846 [info] Experiment 'pythonTestAdapter' is active

@karthiknadig
Copy link
Member

@dobin please try the settings mentioned here #23392 (comment) . If those don’t work, please share a minimal repro.

@dobin
Copy link

dobin commented Jun 2, 2024

pythonTestAdapter was enabled.

I can reproduce it with the testrepo of karthiknadig from above https://github.com/ljh740/pymre

image

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jun 2, 2024
@mntusr
Copy link

mntusr commented Jun 8, 2024

I experience the same problem. Platform: Windows 10. Experiments enabled: pythonCreateEnvOnPipInstall, pythonRecommendTensorboardExt, pythonSurveyNotification, pythonTerminalEnvVarActivation, pythonTestAdapter.

I checked the source code of the Python extension. I found that python_files/unittestadapter/discovery.py changed between the Python extension version 2024.4.1. and 2024.6.0. Among many changes, the following lines were removed from the function discover_tests.

if "/" in start_dir:  #  is a subdir
    parent_dir = os.path.dirname(start_dir)
    sys.path.insert(0, parent_dir)
else:
    sys.path.insert(0, cwd)

If I reintroduce these four lines to their original place in version 2024.8.0., then run the test discovery with the testrepo, the error disappears.

Original discover_tests at 2024.8.0:

def discover_tests(
    start_dir: str,
    pattern: str,
    top_level_dir: Optional[str],
) -> DiscoveryPayloadDict:
    """..."""
    cwd = os.path.abspath(start_dir)
    #  ...

New discover_tests:

def discover_tests(
    start_dir: str,
    pattern: str,
    top_level_dir: Optional[str],
) -> DiscoveryPayloadDict:
    """..."""
    cwd = os.path.abspath(start_dir)
    # start of lines to addd
    if "/" in start_dir:  #  is a subdir
        parent_dir = os.path.dirname(start_dir)
        sys.path.insert(0, parent_dir)
    else:
        sys.path.insert(0, cwd)
    # end lines
    #...

These lines were removed at PR #22390

@dobin
Copy link

dobin commented Jun 22, 2024

Is there a timeline on when the fix for this issue is deployed?

@eleanorjboyd
Copy link
Member

Hello! I have put a fix out in the most recent version of vscode insiders- would someone be able to get the newest version of the insiders python extension and test to see if this bug is resolved?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jun 27, 2024
@mntusr
Copy link

mntusr commented Jun 30, 2024

I checked the pre-release version and I can confirm, it fixes the issue.

@eleanorjboyd
Copy link
Member

Great! Thank you!

@eleanorjboyd eleanorjboyd added this to the July 2024 milestone Jul 1, 2024
@eleanorjboyd eleanorjboyd added area-testing verified Verification succeeded author-verification-requested Issues potentially verifiable by issue author labels Jul 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing author-verification-requested Issues potentially verifiable by issue author info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants