5 import mozharness
.base
.log
as log
6 from mozharness
.base
.log
import ERROR
7 import mozharness
.base
.script
as script
8 from mozharness
.mozilla
.buildbot
import BuildbotMixin
, TBPL_SUCCESS
, \
9 TBPL_FAILURE
, EXIT_STATUS_DICT
12 class CleanupObj(script
.ScriptMixin
, log
.LogMixin
):
14 super(CleanupObj
, self
).__init
__()
16 self
.config
= {'log_level': ERROR
}
22 for f
in ('test_logs', 'test_dir', 'tmpfile_stdout', 'tmpfile_stderr'):
26 class BuildbotScript(BuildbotMixin
, script
.BaseScript
):
27 def __init__(self
, **kwargs
):
28 super(BuildbotScript
, self
).__init
__(**kwargs
)
31 # TestBuildbotStatus {{{1
32 class TestBuildbotStatus(unittest
.TestCase
):
33 # I need a log watcher helper function, here and in test_log.
39 # Close the logfile handles, or windows can't remove the logs
40 if hasattr(self
, 's') and isinstance(self
.s
, object):
44 def test_over_max_log_size(self
):
45 self
.s
= BuildbotScript(config
={'log_type': 'multi',
46 'buildbot_max_log_size': 200},
47 initial_config_file
='test/test.json')
49 self
.s
.buildbot_status(TBPL_SUCCESS
)
50 self
.assertEqual(self
.s
.return_code
, EXIT_STATUS_DICT
[TBPL_FAILURE
])
52 def test_under_max_log_size(self
):
53 self
.s
= BuildbotScript(config
={'log_type': 'multi',
54 'buildbot_max_log_size': 20000},
55 initial_config_file
='test/test.json')
57 self
.s
.buildbot_status(TBPL_SUCCESS
)
58 self
.assertEqual(self
.s
.return_code
, EXIT_STATUS_DICT
[TBPL_SUCCESS
])
61 if __name__
== '__main__':