Fix regression with JS tests only working the first time.

The JS tests would fail on the second run due to memcache having
dirty data.  This change sets a new KEY_PREFIX whenever you launch
a server in test mode.

(imported from commit 4d41e6b79ab3bb7cb4c96b37050f0b1c9abc6b5e)
This commit is contained in:
Steve Howell 2013-07-02 19:26:00 -04:00
parent 078defaf15
commit 71dec63ad1

View File

@ -37,6 +37,11 @@ def memcached_stats_finish():
memcached_total_time += (time.time() - memcached_time_start)
def get_or_create_key_prefix():
if settings.TEST_SUITE:
# This sets the prefix mostly for the benefit of the JS tests.
# The Python tests overwrite KEY_PREFIX on each test.
return 'test_suite:' + str(os.getpid()) + ':'
filename = os.path.join(settings.DEPLOY_ROOT, "memcached_prefix")
try:
fd = os.open(filename, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0444)