Merge lp:~xnox/phablet-tools/py2-3 into lp:phablet-tools
- py2-3
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Sergio Schvezov |
Approved revision: | 248 |
Merged at revision: | 242 |
Proposed branch: | lp:~xnox/phablet-tools/py2-3 |
Merge into: | lp:phablet-tools |
Diff against target: |
125 lines (+40/-11) 2 files modified
phablet-click-test-setup (+31/-10) phablet-test-run (+9/-1) |
To merge this branch: | bzr merge lp:~xnox/phablet-tools/py2-3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Pitt | Approve | ||
Andy Doan (community) | Approve | ||
Sergio Schvezov | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Nicholas Skaggs | Pending | ||
Review via email: mp+205608@code.launchpad.net |
Commit message
Support python2 and python3 based autopilot tests.
Description of the change
Support python2 and python3 based autopilot tests.
- 241. By Dimitri John Ledkov
-
correct pythonpath
Dimitri John Ledkov (xnox) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:241
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Dimitri John Ledkov (xnox) wrote : | # |
This branch should land ahead of https:/
Sergio Schvezov (sergiusens) wrote : | # |
@balloons can you make the rule xnox mentions something true for the core apps? Or provide a list of py3 ready clicks.
Sergio Schvezov (sergiusens) wrote : | # |
60 + entry['
the autopilot extension I talked about was not part of x-source but part of a new node at the same lever of x-source called
"x-test": {
"autopilot": "ubuntu_
}
so we can eventually just run the tests for a given package, whatever those tests are; if you want to change anything, we can; adding the autopilot-dir to x-source seems reasonable to me as well.
Andy Doan (doanac) wrote : | # |
I noticed this requires "fromdos" which isn't installed by default for me
- 242. By Dimitri John Ledkov
-
Add fromdos dependency.
- 243. By Dimitri John Ledkov
-
Correct click manifest key
Dimitri John Ledkov (xnox) wrote : | # |
Addressed all review comments.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:243
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Sergio Schvezov (sergiusens) wrote : | # |
69 + if entry['x-test'] and 'autopilot' in entry['x-test']:
70 + get_bzr_
71 + entry['
72 + entry['
73 + test_dir)
So here it would be called like:
def get_bzr_
)
74 + else:
75 + get_bzr_
76 + entry['
77 + 'tests/autopilot',
78 + test_dir,
79 + py2_subdir)
and here
def get_bzr_
)
Seems that in
47 +def get_bzr_
sub_dir needs a None or '' default
Second
test_dir=
and
test_dir=
I would just keep 'tests/autopilot' for both or add some prior check that applies to both to look for '[x-source'
- 244. By Dimitri John Ledkov
-
Simplify get_bzr_tests call.
- 245. By Dimitri John Ledkov
-
pep8
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:245
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:245
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 246. By Dimitri John Ledkov
-
Pick correct python ahead of execution
- 247. By Dimitri John Ledkov
-
Drop bogus depends
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:247
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 248. By Dimitri John Ledkov
-
Add python3 modules
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:248
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:248
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Sergio Schvezov (sergiusens) : | # |
Andy Doan (doanac) : | # |
Martin Pitt (pitti) wrote : | # |
Very nice, thanks Dimitri!
- 249. By Dimitri John Ledkov
-
Merge trunk
Dimitri John Ledkov (xnox) wrote : | # |
With following two packages:
com.ubuntu.calendar 205 or better
com.ubuntu.music 370 or better
We can land this branch without regressing any test-results, and since unity8/
Please allocate a silo / start landing this branch.
Preview Diff
1 | === modified file 'phablet-click-test-setup' |
2 | --- phablet-click-test-setup 2013-10-21 18:14:51 +0000 |
3 | +++ phablet-click-test-setup 2014-03-06 13:08:36 +0000 |
4 | @@ -58,13 +58,15 @@ |
5 | |
6 | lp = None |
7 | |
8 | +py2_subdir = 'legacy-py2' |
9 | + |
10 | basic_packages = ( |
11 | {'source': 'unity8', 'binary': 'unity8'}, |
12 | {'source': 'ubuntu-ui-toolkit', |
13 | 'binary': 'qtdeclarative5-ubuntu-ui-toolkit-plugin'}) |
14 | |
15 | python_packages = ( |
16 | - 'python-mock', 'python-dateutil' |
17 | + 'python-mock', 'python-dateutil', 'python3-dateutil' |
18 | ) |
19 | |
20 | |
21 | @@ -111,6 +113,7 @@ |
22 | def get_python_binary_package(package, target_dir): |
23 | tmp_dir = tempfile.mkdtemp() |
24 | atexit.register(cleanup, tmp_dir) |
25 | + python2_target_dir = os.path.join(target_dir, py2_subdir) |
26 | print('Fetching %s - into %s' % (package, tmp_dir)) |
27 | bpph = lp.archive.getPublishedBinaries( |
28 | binary_name=package, |
29 | @@ -134,12 +137,22 @@ |
30 | 'usr/lib/python2.7/dist-packages') |
31 | python_modules_dir = pyshared_path if os.path.exists(pyshared_path) \ |
32 | else python2_7_path |
33 | - for f in os.listdir(python_modules_dir): |
34 | - source = path.join(python_modules_dir, f) |
35 | - if path.islink(source): |
36 | - source = path.join(python_modules_dir, os.readlink(source)) |
37 | - print('Moving %s to %s' % (source, target_dir)) |
38 | - shutil.move(source, target_dir) |
39 | + if os.path.exists(python_modules_dir): |
40 | + for f in os.listdir(python_modules_dir): |
41 | + source = path.join(python_modules_dir, f) |
42 | + if path.islink(source): |
43 | + source = path.join(python_modules_dir, os.readlink(source)) |
44 | + print('Moving %s to %s' % (source, python2_target_dir)) |
45 | + shutil.move(source, python2_target_dir) |
46 | + python3_modules_dir = os.path.join(extract_dir, |
47 | + 'usr/lib/python3/dist-packages') |
48 | + if os.path.exists(python3_modules_dir): |
49 | + for f in os.listdir(python3_modules_dir): |
50 | + source = path.join(python3_modules_dir, f) |
51 | + if path.islink(source): |
52 | + source = path.join(python3_modules_dir, os.readlink(source)) |
53 | + print('Moving %s to %s' % (source, target_dir)) |
54 | + shutil.move(source, target_dir) |
55 | |
56 | |
57 | def get_source_package_tests(package, version, target_dir): |
58 | @@ -163,15 +176,17 @@ |
59 | shutil.move(test_dir, target_dir) |
60 | |
61 | |
62 | -def get_bzr_tests(branch, revision, target_dir): |
63 | +def get_bzr_tests(branch, revision, autopilot_dir, target_dir, sub_dir): |
64 | tmp_dir = tempfile.mkdtemp() |
65 | atexit.register(cleanup, tmp_dir) |
66 | print('Checking out %s to %s' % (branch, path.join(tmp_dir, 'work'))) |
67 | check_call(['bzr', 'checkout', '--lightweight', branch, '-r', revision, |
68 | 'work'], cwd=tmp_dir) |
69 | - test_base_dir = path.join(tmp_dir, 'work', 'tests', 'autopilot') |
70 | + test_base_dir = path.join(tmp_dir, 'work', autopilot_dir) |
71 | test_dirs = filter((lambda x: path.isdir(path.join(test_base_dir, x))), |
72 | os.listdir(test_base_dir)) |
73 | + if sub_dir: |
74 | + target_dir = os.path.join(target_dir, sub_dir) |
75 | for test_dir in test_dirs: |
76 | test_dir = path.join(test_base_dir, test_dir) |
77 | print('Moving %s to %s' % (test_dir, target_dir)) |
78 | @@ -194,9 +209,14 @@ |
79 | print('Only keeping entries with x-source') |
80 | manifest = [entry for entry in manifest if 'x-source' in entry] |
81 | for entry in manifest: |
82 | + subdir = py2_subdir |
83 | + if 'x-test' in entry and 'autopilot' in entry['x-test']: |
84 | + subdir = None |
85 | get_bzr_tests(entry['x-source']['vcs-bzr'], |
86 | entry['x-source']['vcs-bzr-revno'], |
87 | - test_dir) |
88 | + 'tests/autopilot', |
89 | + test_dir, |
90 | + subdir) |
91 | |
92 | |
93 | def main(): |
94 | @@ -208,6 +228,7 @@ |
95 | series = adb.shell('lsb_release -c -s').strip() |
96 | lp = LP(series, arch) |
97 | test_dir = tempfile.mkdtemp() |
98 | + os.mkdir(os.path.join(test_dir, py2_subdir)) |
99 | atexit.register(cleanup, test_dir) |
100 | fetch_test_base(adb, test_dir) |
101 | fetch_click_tests(adb, test_dir, args.user, args.click) |
102 | |
103 | === modified file 'phablet-test-run' |
104 | --- phablet-test-run 2014-01-20 19:59:53 +0000 |
105 | +++ phablet-test-run 2014-03-06 13:08:36 +0000 |
106 | @@ -100,10 +100,18 @@ |
107 | |
108 | run_autopilot_test() { |
109 | exec_with_adb chmod 666 /dev/uinput |
110 | + |
111 | + # First let's try python3, without python2 path |
112 | + defaultpy="/usr/bin/python3" |
113 | + import_error=$(adb shell "cd /home/phablet/autopilot; $defaultpy -c 'import $TESTSUITE'") |
114 | + if [ -n "$import_error" ]; then |
115 | + defaultpy="PYTHONPATH=/home/phablet/autopilot/legacy-py2:/home/phablet/autopilot /usr/bin/python" |
116 | + fi |
117 | + |
118 | # adb shell always returns 0, so we have to do some hackery to get the |
119 | # actual RC from the test |
120 | { |
121 | - apbase="sudo -iu $USER bash -ic \"cd /home/phablet/autopilot; autopilot run $VERBOSE" |
122 | + apbase="sudo -iu $USER bash -ic \"cd /home/phablet/autopilot; $defaultpy -m autopilot.run run $VERBOSE" |
123 | if [ "$RESULTDIR" ]; then |
124 | adb shell "$apbase -o /tmp/test_results.xml -f xml $TESTSUITE\"; echo ADB_RC=\$?" |
125 | echo "***** Test summary *****" |
/home/autopilot/ can have python3 modules, or python3 & 2 bilingual modules (e.g. uitoolkit, unity8 emulators etc. are expected to be bilingual)
/home/autopilot /legacy- py2 can only have python2 modules.
I've modified get_bzr_tests to fetch into python2 location is autopilot_dir is not defined.
If autopilot_dir is defined, it's fetched into python3 location.
Ditto grabbing tests from binary packages, although that doesn't grab python3 tests yet.
The phablet-test-run portion, modifies how autopilot is launched to carefully set PYTHONPATH for python2-only (this is achieved by passing -E (ignore pythonpath) to python3, which is dropped if autopilot re-execs under python2)