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
1=== modified file 'autopilot/__init__.py'
2--- autopilot/__init__.py 2013-05-22 20:43:20 +0000
3+++ autopilot/__init__.py 2013-05-24 05:04:28 +0000
4@@ -59,9 +59,7 @@
5 'recordmydesktop' app to be installed.\
6 Videos are stored in /tmp/autopilot.")
7 parser_run.add_argument("-rd", "--record-directory", required=False,
8- default="/tmp/autopilot", type=str,
9- help="Directory to put recorded tests \
10- (only if -r) specified.")
11+ help="Directory to put recorded tests")
12 parser_run.add_argument("-ro", "--random-order", action='store_true',
13 required=False, default=False,
14 help="Run the tests in random order")
15
16=== modified file 'autopilot/tests/functional/test_autopilot_functional.py'
17--- autopilot/tests/functional/test_autopilot_functional.py 2013-05-24 00:00:06 +0000
18+++ autopilot/tests/functional/test_autopilot_functional.py 2013-05-24 05:04:28 +0000
19@@ -426,6 +426,12 @@
20 ))
21
22 should_delete = not os.path.exists('/tmp/autopilot')
23+ if should_delete:
24+ self.addCleanup(remove_if_exists, "/tmp/autopilot")
25+ else:
26+ self.addCleanup(remove_if_exists,
27+ '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv')
28+
29 code, output, error = self.run_autopilot(["run", "-r", "tests"])
30
31 self.assertThat(code, Equals(1))
32@@ -466,22 +472,23 @@
33 self.create_test_file("test_simple.py", dedent("""\
34
35 from autopilot.testcase import AutopilotTestCase
36-
37+ from time import sleep
38
39 class SimpleTest(AutopilotTestCase):
40
41 def test_simple(self):
42+ sleep(1)
43 self.fail()
44 """
45 ))
46- video_dir = mktemp()
47- self.addCleanup(remove_if_exists, video_dir)
48+ self.addCleanup(remove_if_exists,
49+ '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv')
50
51- code, output, error = self.run_autopilot(["run", "-rd", video_dir, "tests"])
52+ code, output, error = self.run_autopilot(["run", "tests"])
53
54 self.assertThat(code, Equals(1))
55- self.assertFalse(os.path.exists(video_dir))
56- self.assertFalse(os.path.exists('%s/tests.test_simple.SimpleTest.test_simple.ogv' % (video_dir)))
57+ self.assertFalse(os.path.exists(
58+ '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv'))
59
60 def test_runs_with_import_errors_fail(self):
61 """Import errors inside a test must be considered a test failure."""
62
63=== modified file 'autopilot/tests/unit/test_command_line_args.py'
64--- autopilot/tests/unit/test_command_line_args.py 2013-05-22 20:43:20 +0000
65+++ autopilot/tests/unit/test_command_line_args.py 2013-05-24 05:04:28 +0000
66@@ -220,10 +220,6 @@
67 args = self.parse_args("run --record foo")
68 self.assertThat(args.record, Equals(True))
69
70- def test_run_command_record_dir_flag_default(self):
71- args = self.parse_args("run foo")
72- self.assertThat(args.record_directory, Equals("/tmp/autopilot"))
73-
74 def test_run_command_record_dir_flag_short(self):
75 args = self.parse_args("run -rd /path/to/dir foo")
76 self.assertThat(args.record_directory, Equals("/path/to/dir"))
77
78=== modified file 'bin/autopilot'
79--- bin/autopilot 2013-05-22 20:43:20 +0000
80+++ bin/autopilot 2013-05-24 05:04:28 +0000
81@@ -90,7 +90,12 @@
82
83 import autopilot.globals
84
85+ if args.record_directory:
86+ args.record = True
87+
88 if args.record:
89+ if not args.record_directory:
90+ args.record_directory = '/tmp/autopilot'
91 if subprocess.call(['which', 'recordmydesktop'], stdout=subprocess.PIPE) != 0:
92 print "ERROR: The application 'recordmydesktop' needs to be installed to record failing jobs."
93 exit(1)

Subscribers

People subscribed via source and target branches