Merge lp:~liuyq0307/lava-android-test/exclude-shells-commands-hostshells-test-from-list into lp:lava-android-test

Proposed by Yongqin Liu
Status: Work in progress
Proposed branch: lp:~liuyq0307/lava-android-test/exclude-shells-commands-hostshells-test-from-list
Merge into: lp:lava-android-test
Diff against target: 40 lines (+16/-3)
1 file modified
lava_android_test/provider.py (+16/-3)
To merge this branch: bzr merge lp:~liuyq0307/lava-android-test/exclude-shells-commands-hostshells-test-from-list
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+144222@code.launchpad.net

Description of the change

 exclue the shells/commands/hostshells test from the list-tests command

 these three tests(shells/commands/hostshells)are not the real test,
 and so that they can not be installed and run, so here is the fix to
 exclude them from the list-tests sub command

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

This is change concerns me a bit:

> def list_test(self):
> - return self.list_mod(test_definitions.__path__)
> + providers = self.get_test_provider_list()
> + avoid_dirs = []
> + for provider in providers:
> + test_prefix = provider.test_prefix
> + if test_prefix:
> + avoid_dirs.append('%ss' % test_prefix)
> + test_list = self.list_mod(test_definitions.__path__)
> + if not avoid_dirs:
> + return test_list
> + else:
> + ret_list = []
> + for test_id in test_list:
> + if not test_id in avoid_dirs:
> + ret_list.append(test_id)
> + return ret_list
>

The way avoid_dirs gets built is based on your current naming
convention. Instead of guessing avoid dirs that way, why not do
something like:

  def _get_dirs(pathname):
    return [x for x in os.listdir(pathname) if os.path.isdir(x)]

then you could just do:
   avoid_dirs = _get_dirs(test_definitions.__path__)

I'm not a big fan of the logic for removing those items from the list.
The "if not avoid_dirs:" check isn't needed.

233. By Yongqin Liu

merge with trunk

234. By Yongqin Liu

keep the original change of provider.py for review

Unmerged revisions

234. By Yongqin Liu

keep the original change of provider.py for review

233. By Yongqin Liu

merge with trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_android_test/provider.py'
2--- lava_android_test/provider.py 2013-01-22 16:30:42 +0000
3+++ lava_android_test/provider.py 2013-01-22 17:13:19 +0000
4@@ -113,7 +113,21 @@
5 class CommonTestProvider(TestProvider):
6
7 def list_test(self):
8- return self.list_mod(test_definitions.__path__)
9+ providers = self.get_test_provider_list()
10+ avoid_dirs = []
11+ for provider in providers:
12+ test_prefix = provider.test_prefix
13+ if test_prefix:
14+ avoid_dirs.append('%ss' % test_prefix)
15+ test_list = self.list_mod(test_definitions.__path__)
16+ if not avoid_dirs:
17+ return test_list
18+ else:
19+ ret_list = []
20+ for test_id in test_list:
21+ if not test_id in avoid_dirs:
22+ ret_list.append(test_id)
23+ return ret_list
24
25 def load_test(self, test_name=None, serial=None):
26 importpath = "lava_android_test.test_definitions.%s" % test_name
27@@ -231,7 +245,7 @@
28 steps_adb_pre=INSTALL_STEPS_ADB_PRE),
29 runner=testdef.AndroidTestRunner(
30 adbshell_steps=ADB_SHELL_STEPS),
31- parser=testdef.AndroidSimpleTestParser(PATTERN),
32+ parser=testdef.AndroidSimpleTestParser(),
33 adb=ADB(serial))
34 return testobj
35
36@@ -273,4 +287,3 @@
37 parser=testdef.AndroidSimpleTestParser(),
38 adb=ADB(serial))
39 return testobj
40-

Subscribers

People subscribed via source and target branches