supybot-test: Ensure --clean doesn't leave 'backup' and 'test-logs' directories

This commit is contained in:
Valentin Lorentz 2023-09-04 17:36:18 +02:00
parent acad80296a
commit 8029e2b390

View File

@ -49,8 +49,9 @@ if not os.path.exists('test-conf'):
registryFilename = os.path.join('test-conf', 'test.conf') registryFilename = os.path.join('test-conf', 'test.conf')
fd = open(registryFilename, 'w') fd = open(registryFilename, 'w')
fd.write(""" fd.write("""
supybot.directories.data: %(base_dir)s/test-data supybot.directories.backup: /dev/null
supybot.directories.conf: %(base_dir)s/test-conf supybot.directories.conf: %(base_dir)s/test-conf
supybot.directories.data: %(base_dir)s/test-data
supybot.directories.log: %(base_dir)s/test-logs supybot.directories.log: %(base_dir)s/test-logs
supybot.reply.whenNotCommand: True supybot.reply.whenNotCommand: True
supybot.log.stdout: False supybot.log.stdout: False
@ -229,8 +230,8 @@ def main():
runner = unittest.TextTestRunner(verbosity=2) runner = unittest.TextTestRunner(verbosity=2)
print('Testing began at %s (pid %s)' % (time.ctime(), os.getpid())) print('Testing began at %s (pid %s)' % (time.ctime(), os.getpid()))
if options.clean: if options.clean:
log.setLevel(100) # don't log anything anymore
shutil.rmtree(conf.supybot.directories.log()) shutil.rmtree(conf.supybot.directories.log())
log._mkDirs()
shutil.rmtree(conf.supybot.directories.conf()) shutil.rmtree(conf.supybot.directories.conf())
shutil.rmtree(conf.supybot.directories.data()) shutil.rmtree(conf.supybot.directories.data())
result = runner.run(suite) result = runner.run(suite)