Fix test gevent monkey patching
This commit is contained in:
parent
3e82595193
commit
9871a4e36f
1 changed files with 12 additions and 10 deletions
|
@ -11,6 +11,9 @@ import datetime
|
||||||
import pytest
|
import pytest
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
import gevent
|
||||||
|
from gevent import monkey
|
||||||
|
monkey.patch_all(thread=False, subprocess=False)
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption("--slow", action='store_true', default=False, help="Also run slow tests")
|
parser.addoption("--slow", action='store_true', default=False, help="Also run slow tests")
|
||||||
|
@ -55,15 +58,8 @@ fmt = logging.Formatter(fmt='+%(relative)ss %(levelname)-8s %(name)s %(message)s
|
||||||
|
|
||||||
# Load plugins
|
# Load plugins
|
||||||
from Plugin import PluginManager
|
from Plugin import PluginManager
|
||||||
PluginManager.plugin_manager.loadPlugins()
|
|
||||||
config.loadPlugins()
|
|
||||||
config.parse() # Parse again to add plugin configuration options
|
|
||||||
|
|
||||||
config.data_dir = "src/Test/testdata" # Use test data for unittests
|
config.data_dir = "src/Test/testdata" # Use test data for unittests
|
||||||
config.debug_socket = True # Use test data for unittests
|
|
||||||
config.verbose = True # Use test data for unittests
|
|
||||||
config.tor = "disable" # Don't start Tor client
|
|
||||||
config.trackers = []
|
|
||||||
|
|
||||||
os.chdir(os.path.abspath(os.path.dirname(__file__) + "/../..")) # Set working dir
|
os.chdir(os.path.abspath(os.path.dirname(__file__) + "/../..")) # Set working dir
|
||||||
# Cleanup content.db caches
|
# Cleanup content.db caches
|
||||||
|
@ -72,9 +68,15 @@ if os.path.isfile("%s/content.db" % config.data_dir):
|
||||||
if os.path.isfile("%s-temp/content.db" % config.data_dir):
|
if os.path.isfile("%s-temp/content.db" % config.data_dir):
|
||||||
os.unlink("%s-temp/content.db" % config.data_dir)
|
os.unlink("%s-temp/content.db" % config.data_dir)
|
||||||
|
|
||||||
import gevent
|
PluginManager.plugin_manager.loadPlugins()
|
||||||
from gevent import monkey
|
config.loadPlugins()
|
||||||
monkey.patch_all(thread=False, subprocess=False)
|
config.parse() # Parse again to add plugin configuration options
|
||||||
|
|
||||||
|
config.debug_socket = True # Use test data for unittests
|
||||||
|
config.verbose = True # Use test data for unittests
|
||||||
|
config.tor = "disable" # Don't start Tor client
|
||||||
|
config.trackers = []
|
||||||
|
config.data_dir = "src/Test/testdata" # Use test data for unittests
|
||||||
|
|
||||||
from Site import Site
|
from Site import Site
|
||||||
from Site import SiteManager
|
from Site import SiteManager
|
||||||
|
|
Loading…
Reference in a new issue