first-package-wins = true
where = test
-[requirements]
+[sqla_testing]
requirement_cls=test.lib.requires:DefaultRequirements
+profile_file=test/lib/profiles.txt
[db]
sqlite=sqlite:///:memory:
post_configure.append(_reverse_topological)
def _requirements(options, file_config):
- from test.lib import testing
- requirement_cls = file_config.get('requirements', "requirement_cls")
+ from ..lib import testing
+ requirement_cls = file_config.get('sqla_testing', "requirement_cls")
modname, clsname = requirement_cls.split(":")
post_configure.append(_requirements)
+
+def _setup_profiling(options, file_config):
+ from ..lib import profiling
+ profiling._profile_stats = profiling.ProfileStatsFile(
+ file_config.get('sqla_testing', 'profile_file'))
+
+post_configure.append(_setup_profiling)
\ No newline at end of file
from nose.plugins import Plugin
from nose import SkipTest
-from test.bootstrap import config
+from . import config
-from test.bootstrap.config import _log, _list_dbs, _zero_timeout, \
+from .config import _log, _list_dbs, _zero_timeout, \
_engine_strategy, _server_side_cursors, pre_configure,\
post_configure
# /Users/classic/dev/sqlalchemy/./test/lib/profiles.txt
# This file is written out on a per-environment basis.
-# For each test in aaa_profiling, the corresponding function and
+# For each test in aaa_profiling, the corresponding function and
# environment is located within this file. If it doesn't exist,
# the test is skipped.
-# If a callcount does exist, it is compared to what we received.
+# If a callcount does exist, it is compared to what we received.
# assertions are raised if the counts do not match.
-#
-# To add a new callcount test, apply the function_call_count
-# decorator and re-run the tests using the --write-profiles option -
+#
+# To add a new callcount test, apply the function_call_count
+# decorator and re-run the tests using the --write-profiles option -
# this file will be rewritten including the new count.
-#
+#
# TEST: test.aaa_profiling.test_compiler.CompileTest.test_insert
so no json lib :( need to roll something silly
"""
- def __init__(self):
- from test.bootstrap.config import options
- self.write = options is not None and options.write_profiles
- dirname, fname = os.path.split(__file__)
- self.short_fname = "profiles.txt"
- self.fname = os.path.join(dirname, self.short_fname)
+ def __init__(self, filename):
+ self.write = config.options is not None and config.options.write_profiles
+ self.fname = os.path.abspath(filename)
+ self.short_fname = os.path.split(self.fname)[-1]
self.data = collections.defaultdict(lambda: collections.defaultdict(dict))
self._read()
if self.write:
)
profile_f.close()
-_profile_stats = ProfileStatsFile()
-
from sqlalchemy.util.compat import update_wrapper
def function_call_count(variance=0.05):