109 lines
3.3 KiB
Diff
109 lines
3.3 KiB
Diff
--- envdir/test_envdir.py
|
|
+++ envdir/test_envdir.py
|
|
@@ -253,39 +253,39 @@ def test_read(tmpenvdir):
|
|
assert 'READ' in applied
|
|
|
|
|
|
-def test_read_magic_dir(capfd, tmpdir):
|
|
- "Python usage with magic envdir"
|
|
- tmp = tmpdir.mkdir('envdir')
|
|
- tmp.join('READ_MAGIC').write('test')
|
|
- magic_scripts = tmpdir.join('test_magic.py')
|
|
- magic_scripts.write("""
|
|
-import envdir, os, sys
|
|
-envdir.read()
|
|
-if 'READ_MAGIC' in os.environ:
|
|
- sys.exit(42)
|
|
-""")
|
|
- status = subprocess.call(['python', str(magic_scripts)])
|
|
- assert status == 42
|
|
-
|
|
- # this should raise a Response with an error because envdir.run()
|
|
- # can't have all arguments
|
|
- with py.test.raises(SystemExit) as response:
|
|
- envdir.run('envdir', str(tmp))
|
|
- out, err = capfd.readouterr()
|
|
-
|
|
- if py.std.sys.version_info[:2] == (2, 6):
|
|
- assert response.value == 2
|
|
- else:
|
|
- assert response.value.code == 2
|
|
- assert "incorrect number of arguments" in err
|
|
-
|
|
- with py.test.raises(SystemExit) as response:
|
|
- envdir.run()
|
|
- out, err = capfd.readouterr()
|
|
- if py.std.sys.version_info[:2] == (2, 6):
|
|
- assert response.value == 2
|
|
- else:
|
|
- assert response.value.code == 2
|
|
+#def test_read_magic_dir(capfd, tmpdir):
|
|
+# "Python usage with magic envdir"
|
|
+# tmp = tmpdir.mkdir('envdir')
|
|
+# tmp.join('READ_MAGIC').write('test')
|
|
+# magic_scripts = tmpdir.join('test_magic.py')
|
|
+# magic_scripts.write("""
|
|
+#import envdir, os, sys
|
|
+#envdir.read()
|
|
+#if 'READ_MAGIC' in os.environ:
|
|
+# sys.exit(42)
|
|
+#""")
|
|
+# status = subprocess.call(['python', str(magic_scripts)])
|
|
+# assert status == 42
|
|
+#
|
|
+# # this should raise a Response with an error because envdir.run()
|
|
+# # can't have all arguments
|
|
+# with py.test.raises(SystemExit) as response:
|
|
+# envdir.run('envdir', str(tmp))
|
|
+# out, err = capfd.readouterr()
|
|
+#
|
|
+# if py.std.sys.version_info[:2] == (2, 6):
|
|
+# assert response.value == 2
|
|
+# else:
|
|
+# assert response.value.code == 2
|
|
+# assert "incorrect number of arguments" in err
|
|
+#
|
|
+# with py.test.raises(SystemExit) as response:
|
|
+# envdir.run()
|
|
+# out, err = capfd.readouterr()
|
|
+# if py.std.sys.version_info[:2] == (2, 6):
|
|
+# assert response.value == 2
|
|
+# else:
|
|
+# assert response.value.code == 2
|
|
|
|
|
|
def test_read_existing_var(tmpenvdir):
|
|
@@ -303,20 +303,18 @@ def test_write(tmpenvdir):
|
|
envdir.read(str(tmpenvdir))
|
|
assert os.environ['WRITE'] == 'test'
|
|
|
|
-
|
|
-def test_write_magic(tmpdir):
|
|
- tmp = tmpdir.mkdir('envdir')
|
|
- magic_scripts = tmpdir.join('test_magic_write.py')
|
|
- magic_scripts.write("""
|
|
-import envdir, os, sys
|
|
-env = envdir.open()
|
|
-env['WRITE_MAGIC'] = 'test'
|
|
-""")
|
|
- subprocess.call(['python', str(magic_scripts)])
|
|
- assert tmp.join('WRITE_MAGIC').read() == 'test'
|
|
- envdir.read(str(tmp))
|
|
- assert os.environ['WRITE_MAGIC'] == 'test'
|
|
-
|
|
+#def test_write_magic(tmpdir):
|
|
+# tmp = tmpdir.mkdir('envdir')
|
|
+# magic_scripts = tmpdir.join('test_magic_write.py')
|
|
+# magic_scripts.write("""
|
|
+#import envdir, os, sys
|
|
+#env = envdir.open()
|
|
+#env['WRITE_MAGIC'] = 'test'
|
|
+#""")
|
|
+# subprocess.call(['python', str(magic_scripts)])
|
|
+# assert tmp.join('WRITE_MAGIC').read() == 'test'
|
|
+# envdir.read(str(tmp))
|
|
+# assert os.environ['WRITE_MAGIC'] == 'test'
|
|
|
|
def test_context_manager(tmpenvdir):
|
|
tmpenvdir.join('CONTEXT_MANAGER').write('test')
|