mirror of https://github.com/scrapy/scrapy.git
23 lines
568 B
Python
23 lines
568 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
from twisted.internet.defer import Deferred
|
|
|
|
|
|
def twisted_sleep(seconds):
|
|
from twisted.internet import reactor
|
|
|
|
d = Deferred()
|
|
reactor.callLater(seconds, d.callback, None)
|
|
return d
|
|
|
|
|
|
def get_script_run_env() -> dict[str, str]:
|
|
"""Return a OS environment dict suitable to run scripts shipped with tests."""
|
|
|
|
tests_path = Path(__file__).parent.parent
|
|
pythonpath = str(tests_path) + os.pathsep + os.environ.get("PYTHONPATH", "")
|
|
env = os.environ.copy()
|
|
env["PYTHONPATH"] = pythonpath
|
|
return env
|