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

sending whole function not just print line #23697

Closed
eleanorjboyd opened this issue Jun 25, 2024 · 1 comment
Closed

sending whole function not just print line #23697

eleanorjboyd opened this issue Jun 25, 2024 · 1 comment
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@eleanorjboyd
Copy link
Member

Testing #23676

I have code that looks like this:

def pytest_load_initial_conftests(early_config, parser, args):
    global TEST_RUN_PIPE
    TEST_RUN_PIPE = os.getenv("TEST_RUN_PIPE")
    error_string = (
        "PYTEST ERROR: TEST_RUN_PIPE is not set at the time of pytest starting. "
        "Please confirm this environment variable is not being changed or removed "
        "as it is required for successful test discovery and execution."
        f"TEST_RUN_PIPE = {TEST_RUN_PIPE}\n"
    )
    if not TEST_RUN_PIPE:
        print(error_string, file=sys.stderr)
    if "--collect-only" in args:
        global IS_DISCOVERY
        IS_DISCOVERY = True
    # check if --rootdir is in the args
    for arg in args:
        if "--rootdir=" in arg:
            rootdir = arg.split("--rootdir=")[1]
            if not os.path.exists(rootdir):
                raise VSCodePytestError(
                    f"The path set in the argument --rootdir={rootdir} does not exist."
                )
            # Check if the rootdir is a symlink or a child of a symlink to the current cwd.
            isSymlink = False
            if os.path.islink(rootdir):
                isSymlink = True
                print(
                    f"Plugin info[vscode-pytest]: rootdir argument, {rootdir}, is identified as a symlink."
                )
            elif pathlib.Path(os.path.realpath(rootdir)) != rootdir:
                print("Plugin info[vscode-pytest]: Checking if rootdir is a child of a symlink.")
                isSymlink = has_symlink_parent(rootdir)
            if isSymlink:
                print(
                    f"Plugin info[vscode-pytest]: rootdir argument, {rootdir}, is identified as a symlink or child of a symlink, adjusting pytest paths accordingly.",
                )
                global SYMLINK_PATH
                SYMLINK_PATH = pathlib.Path(rootdir)


I have my cursor over print("Plugin info[vscode-pytest]: Checking if rootdir is a child of a symlink.") and instead it sends the whole function not just the print line. I would have expected it to send just the print line- is this an incorrect assumption?

@eleanorjboyd
Copy link
Member Author

closing as dup of #23696

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Jun 25, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants