Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cms/envs/acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def seed():
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': TEST_ROOT / "db" / "test_mitx_%s.db" % seed(),
'TEST_NAME': TEST_ROOT / "db" / "test_mitx_%s.db" % seed(),
'NAME': TEST_ROOT / "db" / "test_edx.db",
'TEST_NAME': TEST_ROOT / "db" / "test_edx.db"
}
}

Expand Down
77 changes: 0 additions & 77 deletions cms/envs/acceptance_static.py

This file was deleted.

4 changes: 2 additions & 2 deletions lms/envs/acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def seed():
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': TEST_ROOT / "db" / "test_mitx_%s.db" % seed(),
'TEST_NAME': TEST_ROOT / "db" / "test_mitx_%s.db" % seed(),
'NAME': TEST_ROOT / "db" / "test_edx.db",
'TEST_NAME': TEST_ROOT / "db" / "test_edx.db",
}
}

Expand Down
77 changes: 0 additions & 77 deletions lms/envs/acceptance_static.py

This file was deleted.

32 changes: 26 additions & 6 deletions rakelib/tests.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ CLOBBER.include(REPORT_DIR, 'test_root/*_repo', 'test_root/staticfiles')
# Create the directory to hold coverage reports, if it doesn't already exist.
directory REPORT_DIR

ACCEPTANCE_DB = 'test_root/db/test_edx.db'

def test_id_dir(path)
return File.join(".testids", path.to_s)
end
Expand All @@ -30,7 +32,7 @@ def run_tests(system, report_dir, test_id=nil, stop_on_failure=true)
test_sh(run_under_coverage(cmd, system))
end

def run_acceptance_tests(system, report_dir, harvest_args)
def create_acceptance_db(system)
# HACK: Since now the CMS depends on the existence of some database tables
# that used to be in LMS (Role/Permissions for Forums) we need to make
# sure the acceptance tests create/migrate the database tables
Expand All @@ -43,6 +45,22 @@ def run_acceptance_tests(system, report_dir, harvest_args)
end
sh(django_admin(system, 'acceptance', 'syncdb', '--noinput'))
sh(django_admin(system, 'acceptance', 'migrate', '--noinput'))
end

def setup_acceptance_db(system, fasttest=false)
# If running under fasttest mode and the database already
# exists, skip the migrations.
if File.exists?(ACCEPTANCE_DB)
if not fasttest
File.delete(ACCEPTANCE_DB)
create_acceptance_db(system)
end
else
create_acceptance_db(system)
end
end

def run_acceptance_tests(system, report_dir, harvest_args)
test_sh(django_admin(system, 'acceptance', 'harvest', '--debug-mode', '--tag -skip', harvest_args))
end

Expand All @@ -58,7 +76,7 @@ end

task :clean_test_files do
desc "Clean fixture files used by tests"
sh("git clean -fqdx test_root")
sh("git clean -fqdx test_root/logs test_root/data test_root/staticfiles test_root/uploads")
end

task :clean_reports_dir => REPORT_DIR do
Expand Down Expand Up @@ -91,13 +109,15 @@ TEST_TASK_DIRS = []

# Run acceptance tests
desc "Run acceptance tests"
#gather_assets uses its own env because acceptance contains seeds to make the information unique
#acceptance_static is acceptance without the random seeding
task "test_acceptance_#{system}", [:harvest_args] => [:clean_test_files, "#{system}:gather_assets:acceptance_static", "fasttest_acceptance_#{system}"]
task "test_acceptance_#{system}", [:harvest_args] => [:clean_test_files, "#{system}:gather_assets:acceptance"] do |t, args|
setup_acceptance_db(system)
Rake::Task["fasttest_acceptance_#{system}"].invoke(*args)
end

desc "Run acceptance tests without collectstatic"
desc "Run acceptance tests without collectstatic or database migrations"
task "fasttest_acceptance_#{system}", [:harvest_args] => [report_dir, :clean_reports_dir, :predjango] do |t, args|
args.with_defaults(:harvest_args => '')
setup_acceptance_db(system, fasttest=true)
run_acceptance_tests(system, report_dir, args.harvest_args)
end

Expand Down