Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, *args): # type: ignore[no-untyped-def]
self.root = self
def namelist(self): # type: ignore[no-untyped-def]
return []
import zipp # type: ignore[import]
zippPath = zipp.Path
zipp.Path = FakeZipPath
from importlib_metadata import FastPath # type: ignore[import]
FastPath.zip_children = lambda _: []
zipp.Path = zippPath
import os
import pytest
__file__ = "py.test"
sys.argv[0] = sys.argv[0].replace("main.py", "py.test")
code = pytest.main()
sys.stdout.flush()
sys.stderr.flush()
if stop_profiling:
stop_profiling()
os._exit(code)
# Thus we first must no-op `zipp` to make the importlib_metadata import behave,
# then we can properly neuter importlib_metadata and restore `zipp` support.
#
# Once we fully switch to Py3 and use importlib.metadata from stdlib, this can
# be simplifed as the __version__ complications will be moot.
class FakeZipPath(object):
def __init__(self, *args): # type: ignore[no-untyped-def]
self.root = self
def namelist(self): # type: ignore[no-untyped-def]
return []
import zipp # type: ignore[import]
zippPath = zipp.Path
zipp.Path = FakeZipPath
from importlib_metadata import FastPath # type: ignore[import]
FastPath.zip_children = lambda _: []
zipp.Path = zippPath
import os
import pytest
__file__ = "py.test"
sys.argv[0] = sys.argv[0].replace("main.py", "py.test")
code = pytest.main()
sys.stdout.flush()
sys.stderr.flush()
# then we can properly neuter importlib_metadata and restore `zipp` support.
#
# Once we fully switch to Py3 and use importlib.metadata from stdlib, this can
# be simplifed as the __version__ complications will be moot.
class FakeZipPath(object):
def __init__(self, *args): # type: ignore[no-untyped-def]
self.root = self
def namelist(self): # type: ignore[no-untyped-def]
return []
import zipp # type: ignore[import]
zippPath = zipp.Path
zipp.Path = FakeZipPath
from importlib_metadata import FastPath # type: ignore[import]
FastPath.zip_children = lambda _: []
zipp.Path = zippPath
import os
import pytest
__file__ = "py.test"
sys.argv[0] = sys.argv[0].replace("main.py", "py.test")
code = pytest.main()
sys.stdout.flush()
sys.stderr.flush()