All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bugtests.test323.py Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version
"""
Tests using a path inside a zip file for zip imports
"""

import support
import zipfile, time

def addZipEntry(zip, name, data):
    entry = zipfile.ZipInfo()
    entry.filename = name
    entry.date_time = time.gmtime(time.time())
    zip.writestr(entry, data)


zip = zipfile.ZipFile("test323.zip", "w", zipfile.ZIP_DEFLATED)

addZipEntry(zip, "Lib/test323m.py", """
assert __name__ == 'test323m', " __name__ should've been test323m but was %s" % __name__
from java.io import File
expected = "test323.zip%sLib/test323m.py" % (File.separator)
assert expected in __file__, "%s should've been in __file__ but was %s" % (expected, __file__)
""")

zip.close()

import sys
sys.path.append("test323.zip/Lib")

import test323m




© 2015 - 2024 Weber Informatics LLC | Privacy Policy