fix tests for <v3.7

This commit is contained in:
Anthony Scopatz 2019-10-01 17:01:20 -04:00
parent 5afba70f1e
commit f0160e54d8

View file

@ -368,20 +368,25 @@ print(check_output(["echo", "hello"]).decode("utf8"))
#
(
"""
with open("sourced-file.xsh", "w") as f:
f.write('''
import sys
if sys.version_tuple[:2] >= (3, 7):
with open("sourced-file.xsh", "w") as f:
f.write('''
from contextvars import ContextVar
var = ContextVar('var', default='spam')
var.set('foo')
''')
''')
source sourced-file.xsh
source sourced-file.xsh
print("Var " + var.get())
print("Var " + var.get())
import os
os.remove('sourced-file.xsh')
import os
os.remove('sourced-file.xsh')
else:
print("Var foo")
""",
"Var foo\n",
0,