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

[2.8.1] Tests depend on the "python" executable name #1018

Closed
olebole opened this issue Aug 25, 2021 · 1 comment · Fixed by #1026
Closed

[2.8.1] Tests depend on the "python" executable name #1018

olebole opened this issue Aug 25, 2021 · 1 comment · Fixed by #1026
Labels
Milestone

Comments

@olebole
Copy link
Contributor

olebole commented Aug 25, 2021

When running the tests on a standard Debian machine, I get a lot of errors like

______________________ test_asdf_open_failure[version4] _______________________
tmp_path = PosixPath('/tmp/pytest-of-debci/pytest-0/test_asdf_open_failure_version4')
create_editor = <function create_editor.<locals>._create_editor at 0x7f502e72d040>
version = AsdfVersion('1.4.0')
mock_input = <function mock_input.<locals>._mock_input at 0x7f502e72dca0>
    def test_asdf_open_failure(tmp_path, create_editor, version, mock_input):
        file_path = str(tmp_path/"test.asdf")
    
        with asdf.AsdfFile(version=version) as af:
            af["foo"] = "bar"
            af.write_to(file_path)
    
        os.environ["EDITOR"] = create_editor(r"^#ASDF .*?$", "#HJKL 1.0.0")
    
        with file_not_modified(file_path):
            with mock_input(r"\(c\)ontinue editing or \(a\)bort\?", "a"):
>               assert main.main_from_args(["edit", file_path]) == 1
/usr/lib/python3/dist-packages/asdf/commands/tests/test_edit.py:311: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/asdf/commands/main.py:70: in main_from_args
    result = args.func(args)
/usr/lib/python3/dist-packages/asdf/commands/edit.py:62: in run
    return edit(args.filename)
/usr/lib/python3/dist-packages/asdf/commands/edit.py:213: in edit
    open_editor(temp_file.name)
/usr/lib/python3/dist-packages/asdf/commands/edit.py:372: in open_editor
    subprocess.run(f"{editor} {path}", check=True, shell=True) # nosec
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
input = None, capture_output = False, timeout = None, check = True
popenargs = ('python /tmp/pytest-of-debci/pytest-0/test_asdf_open_failure_version4/editor.py /tmp/test-_h78phud.yaml',)
kwargs = {'shell': True}
process = <Popen: returncode: 127 args: ['p', 'y', 't', 'h', 'o', 'n', ' ', '/', 't', ...>
stdout = None, stderr = None, retcode = 127
    def run(*popenargs,
            input=None, capture_output=False, timeout=None, check=False, **kwargs):
        """…"""
        …    
        with Popen(*popenargs, **kwargs) as process:
            try:
                stdout, stderr = process.communicate(input, timeout=timeout)
            except TimeoutExpired as exc:
                process.kill()
                if _mswindows:
                    # …
                    exc.stdout, exc.stderr = process.communicate()
                else:
                    # …
                    process.wait()
                raise
            except:  # Including KeyboardInterrupt, communicate handled that.
                process.kill()
                # We don't call process.wait() as .__exit__ does that for us.
                raise
            retcode = process.poll()
            if check and retcode:
>               raise CalledProcessError(retcode, process.args,
                                         output=stdout, stderr=stderr)
E               subprocess.CalledProcessError: Command 'python /tmp/pytest-of-debci/pytest-0/test_asdf_open_failure_version4/editor.py /tmp/test-_h78phud.yaml' returned non-zero exit status 127.
/usr/lib/python3.9/subprocess.py:528: CalledProcessError
----------------------------- Captured stderr call -----------------------------
/bin/sh: 1: python: not found

The default Python executable on Debian machines is always "python3", which is IMO the standard and always supported.

@eslavich
Copy link
Contributor

Oops, thanks! We'll get that fixed in the next patch to 2.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants