Skip to content

test_csh fails on Solaris due to unexpected prompt in the output #2409

@kulikjak

Description

@kulikjak

Issue

When running the virtualenv test suite on Solaris, I can see both tests in tests/unit/activation/test_csh.py fail.

    def test_csh(activation_tester_class, activation_tester):
        class Csh(activation_tester_class):
            def __init__(self, session):
                super().__init__(CShellActivator, session, "csh", "activate.csh", "csh")

            def print_prompt(self):
                return "echo 'source \"$VIRTUAL_ENV/bin/activate.csh\"; echo $prompt' | csh -i"

>       activation_tester(Csh)

.....

    def assert_output(self, out, raw, tmp_path):
        # pre-activation
        assert out[0], raw
        assert out[1] == "None", raw
        # post-activation
        expected = self._creator.exe.parent / os.path.basename(sys.executable)
        assert self.norm_path(out[2]) == self.norm_path(expected), raw
        assert self.norm_path(out[3]) == self.norm_path(self._creator.dest).replace("\\\\", "\\"), raw
        # Some attempts to test the prompt output print more than 1 line.
        # So we need to check if the prompt exists on any of them.
        prompt_text = f"({self._creator.env_name}) "
        assert any(prompt_text in line for line in out[4:-3]), raw

>       assert out[-3] == "wrote pydoc_test.html", raw
E       AssertionError: /..../virtualenv/virtualenv-20.16.3/.tox/py39/bin/python
E         None
E         /tmp/pytest-of-jkulik/pytest-39/activation-tester-env9/e-$ __________-j/bin/python
E         /tmp/pytest-of-jkulik/pytest-39/activation-tester-env9/e-$ __________-j
E         Warning: no access to tty; thus no job control in this shell...
E         myvm-i386-25280% (e-$ __________-j) myvm-i386-25280%
E         (e-$ __________-j) myvm-i386-25280% wrote pydoc_test.html
E         /..../virtualenv/virtualenv-20.16.3/.tox/py39/bin/python
E         None
E
E       assert '(e-$ __________...doc_test.html' == 'wrote pydoc_test.html'
E         - wrote pydoc_test.html
E         + (e-$ __________-j) myvm-i386-25280% wrote pydoc_test.html

I executed the test suite simply by downloading the sources (from PyPI) and running tox in that directory. I can see the same thing when running pytest directly.

It seems that the test suite doesn't expect the prompt to be there and I can easily fix that when I replace assert out[-3] == "wrote pydoc_test.html", raw with assert "wrote pydoc_test.html" in out[-3], raw though I am not sure whether I can do that.

Environment

  • OS: Oracle Solaris 11.4
  • virtualenv 20.16.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions