Merge lp:~chris.gagnon/autopilot/lp1183618 into lp:autopilot

Proposed by Chris Gagnon
Status: Merged
Approved by: Thomi Richards
Approved revision: 223
Merged at revision: 222
Proposed branch: lp:~chris.gagnon/autopilot/lp1183618
Merge into: lp:autopilot
Diff against target: 93 lines (+19/-13)
4 files modified
autopilot/__init__.py (+1/-3)
autopilot/tests/functional/test_autopilot_functional.py (+13/-6)
autopilot/tests/unit/test_command_line_args.py (+0/-4)
bin/autopilot (+5/-0)
To merge this branch: bzr merge lp:~chris.gagnon/autopilot/lp1183618
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+165529@code.launchpad.net

Commit message

don't require -r if -rd is used fixes lp:1183618

Description of the change

don't require -r if -rd is used

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~chris.gagnon/autopilot/lp1183618 updated
221. By Chris Gagnon

remove unneeded record_directory action

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

A few things.

1)

PEP8 says to have 2 blank lines between module-level functions (well, actually between all blocks at module-level), so the removal of the blank line at diff line 8 should be un-done.

2)

This doesn't make sense:

17 help="Directory to put recorded tests \
18 - (only if -r) specified.")
19 + specified.")

3) You have merge conflict markers in the source.

4) Finally, it seems that you're moifying an existing test, rather than creating a new one for this new feature. I think we need a test that specifies '-rd /some/path' ONLY and then verifies that the video files exist.

Cheers,

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~chris.gagnon/autopilot/lp1183618 updated
222. By Chris Gagnon

undo deleted line

223. By Chris Gagnon

fixed merge conflict

Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

1. is fixed, I use flake8 with vim for pep8 checking, but there are so many errors the new one was hard to see.
2. is fixed
3. is fixed
4. the test without -r was using -rd, I had to modify the test so it would pass. because -r is not required when using -rd. there is already a test for -rd path and -r using the default of /tmp/autopilot

thanks

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'autopilot/__init__.py'
--- autopilot/__init__.py 2013-05-22 20:43:20 +0000
+++ autopilot/__init__.py 2013-05-24 05:04:28 +0000
@@ -59,9 +59,7 @@
59 'recordmydesktop' app to be installed.\59 'recordmydesktop' app to be installed.\
60 Videos are stored in /tmp/autopilot.")60 Videos are stored in /tmp/autopilot.")
61 parser_run.add_argument("-rd", "--record-directory", required=False,61 parser_run.add_argument("-rd", "--record-directory", required=False,
62 default="/tmp/autopilot", type=str,62 help="Directory to put recorded tests")
63 help="Directory to put recorded tests \
64 (only if -r) specified.")
65 parser_run.add_argument("-ro", "--random-order", action='store_true',63 parser_run.add_argument("-ro", "--random-order", action='store_true',
66 required=False, default=False,64 required=False, default=False,
67 help="Run the tests in random order")65 help="Run the tests in random order")
6866
=== modified file 'autopilot/tests/functional/test_autopilot_functional.py'
--- autopilot/tests/functional/test_autopilot_functional.py 2013-05-24 00:00:06 +0000
+++ autopilot/tests/functional/test_autopilot_functional.py 2013-05-24 05:04:28 +0000
@@ -426,6 +426,12 @@
426 ))426 ))
427427
428 should_delete = not os.path.exists('/tmp/autopilot')428 should_delete = not os.path.exists('/tmp/autopilot')
429 if should_delete:
430 self.addCleanup(remove_if_exists, "/tmp/autopilot")
431 else:
432 self.addCleanup(remove_if_exists,
433 '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv')
434
429 code, output, error = self.run_autopilot(["run", "-r", "tests"])435 code, output, error = self.run_autopilot(["run", "-r", "tests"])
430436
431 self.assertThat(code, Equals(1))437 self.assertThat(code, Equals(1))
@@ -466,22 +472,23 @@
466 self.create_test_file("test_simple.py", dedent("""\472 self.create_test_file("test_simple.py", dedent("""\
467473
468 from autopilot.testcase import AutopilotTestCase474 from autopilot.testcase import AutopilotTestCase
469475 from time import sleep
470476
471 class SimpleTest(AutopilotTestCase):477 class SimpleTest(AutopilotTestCase):
472478
473 def test_simple(self):479 def test_simple(self):
480 sleep(1)
474 self.fail()481 self.fail()
475 """482 """
476 ))483 ))
477 video_dir = mktemp()484 self.addCleanup(remove_if_exists,
478 self.addCleanup(remove_if_exists, video_dir)485 '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv')
479486
480 code, output, error = self.run_autopilot(["run", "-rd", video_dir, "tests"])487 code, output, error = self.run_autopilot(["run", "tests"])
481488
482 self.assertThat(code, Equals(1))489 self.assertThat(code, Equals(1))
483 self.assertFalse(os.path.exists(video_dir))490 self.assertFalse(os.path.exists(
484 self.assertFalse(os.path.exists('%s/tests.test_simple.SimpleTest.test_simple.ogv' % (video_dir)))491 '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv'))
485492
486 def test_runs_with_import_errors_fail(self):493 def test_runs_with_import_errors_fail(self):
487 """Import errors inside a test must be considered a test failure."""494 """Import errors inside a test must be considered a test failure."""
488495
=== modified file 'autopilot/tests/unit/test_command_line_args.py'
--- autopilot/tests/unit/test_command_line_args.py 2013-05-22 20:43:20 +0000
+++ autopilot/tests/unit/test_command_line_args.py 2013-05-24 05:04:28 +0000
@@ -220,10 +220,6 @@
220 args = self.parse_args("run --record foo")220 args = self.parse_args("run --record foo")
221 self.assertThat(args.record, Equals(True))221 self.assertThat(args.record, Equals(True))
222222
223 def test_run_command_record_dir_flag_default(self):
224 args = self.parse_args("run foo")
225 self.assertThat(args.record_directory, Equals("/tmp/autopilot"))
226
227 def test_run_command_record_dir_flag_short(self):223 def test_run_command_record_dir_flag_short(self):
228 args = self.parse_args("run -rd /path/to/dir foo")224 args = self.parse_args("run -rd /path/to/dir foo")
229 self.assertThat(args.record_directory, Equals("/path/to/dir"))225 self.assertThat(args.record_directory, Equals("/path/to/dir"))
230226
=== modified file 'bin/autopilot'
--- bin/autopilot 2013-05-22 20:43:20 +0000
+++ bin/autopilot 2013-05-24 05:04:28 +0000
@@ -90,7 +90,12 @@
9090
91 import autopilot.globals91 import autopilot.globals
9292
93 if args.record_directory:
94 args.record = True
95
93 if args.record:96 if args.record:
97 if not args.record_directory:
98 args.record_directory = '/tmp/autopilot'
94 if subprocess.call(['which', 'recordmydesktop'], stdout=subprocess.PIPE) != 0:99 if subprocess.call(['which', 'recordmydesktop'], stdout=subprocess.PIPE) != 0:
95 print "ERROR: The application 'recordmydesktop' needs to be installed to record failing jobs."100 print "ERROR: The application 'recordmydesktop' needs to be installed to record failing jobs."
96 exit(1)101 exit(1)

Subscribers

People subscribed via source and target branches