From 436dadae0a017ce94b94fdbb7207dff797e83c2e Mon Sep 17 00:00:00 2001 From: Celso Providelo Date: Wed, 4 Feb 2015 11:15:08 -0500 Subject: [PATCH] Cleanup the boottest-britney testing script to reflect better its real behavior. --- tests/test_boottest.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/test_boottest.py b/tests/test_boottest.py index e9fda90..acc6675 100644 --- a/tests/test_boottest.py +++ b/tests/test_boottest.py @@ -166,22 +166,24 @@ class TestBoottestEnd2End(TestBase): f.write('''#!%(py)s import argparse import os +import shutil import sys template = """ -green 1.1~beta RUNNING green 1.1~beta -pyqt5-src 1.1~beta PASS pyqt5-src 1.1~beta -pyqt5-src 1.1 FAIL pyqt5-src 1.1 +green 1.1~beta RUNNING +pyqt5-src 1.1~beta PASS +pyqt5-src 1.1 FAIL """ def request(): - os.makedirs(os.path.dirname(args.output)) + work_path = os.path.dirname(args.output) + os.makedirs(work_path) + shutil.copy(args.input, os.path.join(work_path, 'test_input')) with open(args.output, 'w') as f: f.write(template) def submit(): - with open(args.input, 'w') as f: - f.write(template) + pass def collect(): with open(args.output, 'w') as f: @@ -191,7 +193,9 @@ p = argparse.ArgumentParser() p.add_argument('-d') p.add_argument('-s') p.add_argument('-c') + sp = p.add_subparsers() + psubmit = sp.add_parser('submit') psubmit.add_argument('input') psubmit.set_defaults(func=submit) @@ -243,6 +247,14 @@ args.func() BootTest.EXCUSE_LABELS['RUNNING']), '
  • Not considered']) + # The `boottest-britney` input (recorded for testing purposes), + # contains a line matching the requested boottest attempt. + # ' \n' + test_input_path = os.path.join( + self.data.path, 'boottest/work/test_input') + self.assertEqual( + ['green 1.1~beta\n'], open(test_input_path).readlines()) + def test_pass(self): # `Britney` updates boottesting information in excuses when the # package test pass and marks the package as a valid candidate for