Commit aee18689 authored by Jason R. Coombs's avatar Jason R. Coombs

Simplify script creation with context managers and leveraging local variables...

Simplify script creation with context managers and leveraging local variables for the template population.
parent a75c16ed
...@@ -37,20 +37,16 @@ class WrapperTester: ...@@ -37,20 +37,16 @@ class WrapperTester:
""" """
sample_directory = tempdir sample_directory = tempdir
script = cls.script_tmpl % dict(python_exe=nt_quote_arg python_exe = nt_quote_arg(sys.executable)
(sys.executable)) script = cls.script_tmpl % locals()
f = open(os.path.join(sample_directory, cls.script_name), 'w') with open(os.path.join(sample_directory, cls.script_name), 'w') as f:
f.write(script) f.write(script)
f.close()
# also copy cli.exe to the sample directory # also copy cli.exe to the sample directory
with open(os.path.join(sample_directory, cls.wrapper_name), 'wb') as f:
f = open(os.path.join(sample_directory, cls.wrapper_name), 'wb') w = pkg_resources.resource_string('setuptools', cls.wrapper_source)
f.write( f.write(w)
pkg_resources.resource_string('setuptools', cls.wrapper_source)
)
f.close()
class TestCLI(WrapperTester): class TestCLI(WrapperTester):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment