Merge pull request #1657 from xonsh/fix_win_tests

Fix win tests
This commit is contained in:
Anthony Scopatz 2016-09-01 19:39:36 -04:00 committed by GitHub
commit 6052a36531
3 changed files with 34 additions and 1 deletions

13
news/win_test_fixes.rst Normal file
View file

@ -0,0 +1,13 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fix some test problems when win_unicode_console was installed on windows.
**Security:** None

View file

@ -9,7 +9,7 @@ from xonsh.built_ins import ensure_list_of_strs
from xonsh.execer import Execer
from xonsh.tools import XonshBlockError
from xonsh.events import events
from xonsh.platform import ON_WINDOWS
from tools import DummyShell, sp
@ -65,3 +65,16 @@ def xonsh_builtins():
del builtins.compilex
del builtins.aliases
del builtins.events
if ON_WINDOWS:
try:
import win_unicode_console
except ImportError:
pass
else:
@pytest.fixture(autouse=True)
def disable_win_unicode_console(monkeypatch):
""" Disable win_unicode_console if it is present since it collides with
pytests ouptput capture"""
monkeypatch.setattr(win_unicode_console, 'enable', lambda: None)

View file

@ -23,6 +23,13 @@ from xonsh.dirstack import _unc_tempDrives
HERE = os.path.abspath(os.path.dirname(__file__))
PARENT = os.path.dirname(HERE)
def drive_in_use(letter):
return ON_WINDOWS and os.system('vol {}: 2>nul>nul'.format(letter)) == 0
pytestmark = pytest.mark.skipif(any(drive_in_use(l) for l in 'ywzx'),
reason='Drive letters used by tests are '
'are already used by Windows.')
@pytest.yield_fixture(scope="module")
def shares_setup(tmpdir_factory):