Esempio n. 1
0
def tmp_write_prefix(interpreter):
    with tempfile.TemporaryFile() as fd:
        write_file_prefix(fd, interpreter)
        fd.seek(0)
        written = fd.read()

    return written
Esempio n. 2
0
    def test_file_prefix(self):
        with tempfile.TemporaryFile() as fd:
            python = validate_interpreter(Path(sys.executable))
            write_file_prefix(fd, python)
            fd.seek(0)
            written = fd.read()

        assert written == b'#!' + python.as_posix().encode(
            sys.getdefaultencoding()) + b' -sE\n'