File: test_xonsh.py

package info (click to toggle)
python-virtualenv 20.4.0%2Bds-2%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,592 kB
  • sloc: python: 9,471; sh: 155; ansic: 61; csh: 35; makefile: 10
file content (38 lines) | stat: -rw-r--r-- 1,246 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from __future__ import absolute_import, unicode_literals

import sys

import pytest
from flaky import flaky

from virtualenv.activation import XonshActivator


@pytest.mark.slow
@pytest.mark.skipif(
    sys.platform == "win32" or sys.version_info[0:2] >= (3, 9),
    reason="xonsh on 3.9 or Windows is broken - https://github.com/xonsh/xonsh/issues/3689",
)
@flaky(max_runs=2, min_passes=1)
def test_xonsh(activation_tester_class, activation_tester):
    class Xonsh(activation_tester_class):
        def __init__(self, session):
            super(Xonsh, self).__init__(
                XonshActivator,
                session,
                "xonsh.exe" if sys.platform == "win32" else "xonsh",
                "activate.xsh",
                "xsh",
            )
            self._invoke_script = [sys.executable, "-m", "xonsh"]
            self._version_cmd = [sys.executable, "-m", "xonsh", "--version"]

        def env(self, tmp_path):
            env = super(Xonsh, self).env(tmp_path)
            env.update({"XONSH_DEBUG": "1", "XONSH_SHOW_TRACEBACK": "True"})
            return env

        def activate_call(self, script):
            return "{} {}".format(self.activate_cmd, repr(str(script))).strip()

    activation_tester(Xonsh)