Move tests to root dirrectory and fix tox
Move rally/rally/tests -> rally/tests Use sqlite in memory to be able to run tests parallel
This commit is contained in:
parent
8b8b043167
commit
4a28668542
@ -1,4 +1,4 @@
|
||||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ./rally/tests $LISTOPT $IDOPTION
|
||||
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ./tests $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
|
@ -49,6 +49,11 @@ _BACKEND_MAPPING = {'sqlalchemy': 'rally.db.sqlalchemy.api'}
|
||||
IMPL = db_api.DBAPI(backend_mapping=_BACKEND_MAPPING)
|
||||
|
||||
|
||||
def db_cleanup():
|
||||
"""Recreate engine."""
|
||||
IMPL.db_cleanup()
|
||||
|
||||
|
||||
def db_create():
|
||||
"""Initialize DB. This method will drop existing database."""
|
||||
IMPL.db_create()
|
||||
|
@ -30,6 +30,10 @@ def get_backend():
|
||||
return sys.modules[__name__]
|
||||
|
||||
|
||||
def db_cleanup():
|
||||
db_session.cleanup()
|
||||
|
||||
|
||||
def db_create():
|
||||
models.create_db()
|
||||
|
||||
|
@ -15,21 +15,18 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import fixtures
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from rally import db
|
||||
from rally.openstack.common.fixture import config
|
||||
from rally.openstack.common import test
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class DatabaseFixture(fixtures.Fixture):
|
||||
class DatabaseFixture(config.Config):
|
||||
"""Create clean DB before starting test."""
|
||||
def setUp(self):
|
||||
super(DatabaseFixture, self).setUp()
|
||||
db.db_cleanup()
|
||||
self.conf.set_default('connection', "sqlite://", group='database')
|
||||
db.db_create()
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ export PROJECT_NAME="rally"
|
||||
# if equals to 1
|
||||
export OMIT_OSLO_FROM_COVERAGE=0
|
||||
# path to directory with tests
|
||||
export TESTS_DIR="rally/tests/"
|
||||
export TESTS_DIR="tests/"
|
||||
export EGG_INFO_FILE="rally.egg-info/entry_points.txt"
|
||||
|
||||
# run common test script
|
||||
|
Loading…
Reference in New Issue
Block a user