Merge ~canonical-kernel-team/+git/autotest:autotest3 into ~canonical-kernel-team/+git/autotest:master
- Git
- lp:~canonical-kernel-team/+git/autotest
- autotest3
- Merge into master
Status: | Work in progress |
---|---|
Proposed branch: | ~canonical-kernel-team/+git/autotest:autotest3 |
Merge into: | ~canonical-kernel-team/+git/autotest:master |
Diff against target: |
24619 lines (+5157/-5152) 370 files modified
__init__.py (+2/-2) cli/acl_unittest.py (+9/-9) cli/action_common.py (+8/-8) cli/action_common_unittest.py (+25/-25) cli/atest.py (+2/-2) cli/atest_unittest.py (+3/-3) cli/atomicgroup_unittest.py (+2/-2) cli/autotest-rpc-change-protection-level (+1/-1) cli/autotest-rpc-client (+1/-1) cli/autotest-rpc-migrate-host (+1/-1) cli/autotest-rpc-query-keyvals (+1/-1) cli/autotest-rpc-query-results (+1/-1) cli/cli_mock.py (+4/-4) cli/contrib/why_isnt_my_job_running.py (+59/-59) cli/host.py (+4/-4) cli/host_unittest.py (+730/-730) cli/job.py (+10/-10) cli/job_unittest.py (+654/-654) cli/label_unittest.py (+32/-32) cli/rpc.py (+3/-3) cli/rpc_unittest.py (+2/-2) cli/setup.py (+1/-1) cli/test_unittest.py (+50/-50) cli/threads.py (+9/-9) cli/threads_unittest.py (+10/-10) cli/topic_common.py (+45/-45) cli/topic_common_unittest.py (+42/-42) cli/user_unittest.py (+41/-41) client/autotest-daemon (+1/-1) client/autotest-daemon-monitor (+1/-1) client/autotest-distro-def-create (+1/-1) client/autotest-distro-def-view (+1/-1) client/autotest-local (+7/-2) client/autotest-local-streamhandler (+1/-1) client/autotest_local.py (+3/-3) client/base_sysinfo.py (+5/-4) client/base_utils.py (+8/-8) client/bkr_proxy.py (+5/-5) client/canonical.py (+5/-4) client/client_logging_config.py (+1/-1) client/cmdparser.py (+4/-4) client/common.py (+1/-1) client/deps/boottool/boottool.py (+1/-1) client/deps/dejagnu/dejagnu.py (+1/-1) client/deps/disktest/disktest.py (+1/-1) client/deps/grubby/grubby.py (+1/-1) client/deps/iwcap/iwcap.py (+1/-1) client/deps/libaio/libaio.py (+1/-1) client/deps/libcap/libcap.py (+1/-1) client/deps/libnet/libnet.py (+1/-1) client/deps/mysql/mysql.py (+1/-1) client/deps/pgpool/pgpool.py (+1/-1) client/deps/pgsql/pgsql.py (+1/-1) client/deps/systemtap/systemtap.py (+1/-1) client/fsdev_disks.py (+4/-4) client/fsdev_disks_unittest.py (+2/-2) client/fsinfo.py (+9/-9) client/fsinfo_unittest.py (+6/-6) client/harness.py (+2/-2) client/harness_autoserv.py (+2/-2) client/harness_beaker.py (+5/-5) client/harness_simple.py (+1/-1) client/harness_standalone.py (+1/-1) client/harness_unittest.py (+2/-2) client/job.py (+19/-19) client/job_unittest.py (+10/-10) client/kernel.py (+15/-15) client/kernel_config_unittest.py (+2/-2) client/kernel_unittest.py (+10/-10) client/kernel_versions_unittest.py (+3/-3) client/kernelexpand.py (+30/-30) client/kernelexpand_unittest.py (+7/-7) client/kvm_control_unittest.py (+2/-2) client/local_host.py (+1/-1) client/local_host_unittest.py (+2/-2) client/lv_utils.py (+6/-6) client/net/net_tc.py (+3/-3) client/net/net_tc_unittest.py (+2/-2) client/net/net_utils.py (+4/-4) client/net/net_utils_unittest.py (+125/-125) client/parallel.py (+4/-7) client/partition.py (+9/-9) client/partition_unittest.py (+14/-13) client/profilers/cpistat/cpistat (+1/-1) client/profilers/kvm_stat/kvm_stat.py (+2/-2) client/profilers/lockmeter/lockmeter.py (+1/-1) client/profilers/lttng/lttng.py (+1/-1) client/profilers/oprofile/oprofile.py (+2/-2) client/profilers/psstat/psstat.py (+1/-1) client/profilers/readprofile/readprofile.py (+1/-1) client/setup.py (+1/-1) client/setup_job.py (+5/-5) client/setup_job_unittest.py (+5/-5) client/setup_modules.py (+9/-5) client/shared/aexpect.py (+9/-9) client/shared/autotemp_unittest.py (+2/-2) client/shared/backports/__init__.py (+2/-2) client/shared/backports/collections/OrderedDict.py (+7/-7) client/shared/backports/collections/__init__.py (+3/-3) client/shared/backports/collections/defaultdict.py (+2/-2) client/shared/backports/collections/namedtuple.py (+4/-4) client/shared/backports/simplejson/__init__.py (+3/-3) client/shared/backports/simplejson/decoder.py (+10/-8) client/shared/backports/simplejson/encoder.py (+17/-17) client/shared/backports/simplejson/ordered_dict.py (+4/-4) client/shared/backports/simplejson/tool.py (+1/-1) client/shared/backports_unittest.py (+12/-12) client/shared/base_barrier.py (+1/-1) client/shared/base_barrier_unittest.py (+2/-2) client/shared/base_check_version.py (+5/-3) client/shared/base_job.py (+14/-14) client/shared/base_job_unittest.py (+50/-50) client/shared/base_packages.py (+12/-12) client/shared/base_packages_unittest.py (+2/-2) client/shared/base_syncdata.py (+6/-6) client/shared/base_syncdata_unittest.py (+5/-5) client/shared/boottool.py (+1/-1) client/shared/boottool_unittest.py (+9/-9) client/shared/check_version.py (+1/-1) client/shared/control_data.py (+7/-7) client/shared/control_data_unittest.py (+33/-33) client/shared/data_dir.py (+7/-7) client/shared/distro_unittest.py (+2/-2) client/shared/enum.py (+1/-1) client/shared/error.py (+2/-2) client/shared/file_module_loader_unittest.py (+1/-1) client/shared/git.py (+1/-1) client/shared/hosts/__init__.py (+1/-1) client/shared/hosts/base_classes.py (+13/-13) client/shared/hosts/base_classes_unittest.py (+2/-2) client/shared/hosts/scripts/run_helper.py (+1/-1) client/shared/iscsi.py (+2/-2) client/shared/iscsi_unittest.py (+2/-2) client/shared/jsontemplate.py (+21/-21) client/shared/log.py (+2/-2) client/shared/logging_manager.py (+2/-2) client/shared/logging_manager_unittest.py (+12/-12) client/shared/magic.py (+870/-889) client/shared/mail.py (+1/-1) client/shared/mail_unittest.py (+5/-5) client/shared/mock.py (+17/-17) client/shared/openvswitch.py (+6/-6) client/shared/profiler_manager.py (+1/-1) client/shared/profiler_manager_unittest.py (+2/-2) client/shared/progressbar.py (+1/-1) client/shared/remote.py (+12/-12) client/shared/report.py (+6/-6) client/shared/rss_client.py (+9/-9) client/shared/service.py (+2/-2) client/shared/service_unittest.py (+2/-2) client/shared/settings.py (+5/-5) client/shared/settings_unittest.py (+16/-16) client/shared/software_manager.py (+6/-6) client/shared/ssh_key.py (+5/-5) client/shared/test.py (+14/-14) client/shared/test_unittest.py (+4/-4) client/shared/test_utils/config_change_validation.py (+5/-5) client/shared/test_utils/mock.py (+19/-19) client/shared/test_utils/unittest.py (+28/-28) client/shared/utils.py (+50/-46) client/shared/utils_cgroup.py (+18/-18) client/shared/utils_koji.py (+11/-11) client/shared/utils_memory.py (+1/-1) client/shared/utils_unittest.py (+54/-54) client/shared/version.py (+3/-3) client/test.py (+1/-1) client/test_config.py (+6/-6) client/tools/JUnit_api.py (+32/-32) client/tools/autotest (+1/-1) client/tools/avgtime (+1/-1) client/tools/boottool.py (+16/-16) client/tools/crash_handler.py (+8/-8) client/tools/diffprofile (+1/-1) client/tools/make_clean (+1/-1) client/tools/oprofile_diff (+1/-1) client/tools/process_metrics.py (+17/-17) client/tools/regression.py (+15/-15) client/tools/results2junit.py (+11/-6) client/tools/scan_results.py (+6/-6) client/xen.py (+1/-1) conmux/drivers/fence_apc_snmp.py (+33/-32) contrib/coverage.py (+44/-43) contrib/modelviz.py (+5/-5) database_legacy/autotest-upgrade-db (+1/-1) database_legacy/database_connection.py (+2/-2) database_legacy/database_connection_unittest.py (+5/-5) database_legacy/db_utils.py (+2/-2) database_legacy/db_utils_unittest.py (+4/-4) database_legacy/migrate.py (+3/-3) database_legacy/migrate_unittest.py (+15/-15) database_legacy/migrations/037_db_constraints.py (+4/-4) database_legacy/migrations/042_unique_index_on_hqe_job_and_host.py (+1/-1) database_legacy/migrations/044_rename_afe_tables.py (+2/-2) database_legacy/migrations/045_test_planner_framework.py (+1/-1) database_legacy/migrations/046_merge_databases.py (+3/-3) database_legacy/migrations/059_drone_sets_permissions.py (+1/-1) database_legacy/migrations/061_drone_sets_permissions_proper.py (+1/-1) database_legacy/migrations/062_drone_sets_unique.py (+1/-1) database_legacy/setup.py (+1/-1) documentation/source/conf.py (+12/-12) documentation/source/main/remote/Autoserv.rst (+1/-1) frontend/afe/control_file.py (+2/-2) frontend/afe/json_rpc/proxy.py (+3/-3) frontend/afe/json_rpc/serviceHandler.py (+5/-5) frontend/afe/json_rpc/serviceHandler_unittest.py (+6/-6) frontend/afe/management.py (+5/-5) frontend/afe/model_attributes.py (+1/-1) frontend/afe/model_logic.py (+16/-16) frontend/afe/models.py (+26/-26) frontend/afe/models_unittest.py (+14/-14) frontend/afe/readonly_connection.py (+2/-1) frontend/afe/reservations_unittest.py (+2/-2) frontend/afe/resources_unittest.py (+54/-54) frontend/afe/rpc_client_lib.py (+1/-1) frontend/afe/rpc_handler.py (+3/-3) frontend/afe/rpc_interface.py (+6/-6) frontend/afe/rpc_interface_unittest.py (+49/-49) frontend/afe/rpc_utils.py (+3/-3) frontend/afe/rpcserver_logging.py (+1/-1) frontend/afe/test.py (+6/-6) frontend/afe/views.py (+3/-3) frontend/autotest-distro-def-load (+1/-1) frontend/client/gwt_dir (+1/-1) frontend/client_compilation_unittest.py (+3/-3) frontend/db/backends/afe/base.py (+1/-1) frontend/frontend_unittest.py (+3/-3) frontend/make_superuser.py (+8/-8) frontend/manage.py (+1/-1) frontend/settings.py (+1/-1) frontend/setup.py (+1/-1) frontend/setup_test_environment.py (+2/-2) frontend/shared/json_html_formatter.py (+4/-4) frontend/shared/query_lib.py (+2/-2) frontend/shared/resource_lib.py (+22/-22) frontend/shared/resource_test_utils.py (+4/-4) frontend/shared/rest_client.py (+10/-10) frontend/test_utils.py (+3/-3) frontend/tko/csv_encoder.py (+2/-2) frontend/tko/csv_encoder_unittest.py (+3/-3) frontend/tko/graphing_utils.py (+11/-11) frontend/tko/models.py (+3/-3) frontend/tko/models_unittest.py (+2/-2) frontend/tko/resources_unittest.py (+5/-5) frontend/tko/rpc_interface.py (+7/-7) frontend/tko/rpc_interface_unittest.py (+110/-110) frontend/tko/tko_rpc_utils.py (+4/-4) frontend/tko/urls.py (+1/-1) frontend/urls.py (+1/-1) global_config.ini (+12/-14) installation_support/autotest_firewalld_add_service_unittest.py (+1/-1) installation_support/database_manager/__init__.py (+2/-2) installation_support/global_config_set_value.py (+1/-1) installation_support/setup.py (+1/-1) mirror/database.py (+5/-5) mirror/database_unittest.py (+2/-2) mirror/mirror (+1/-1) mirror/setup.py (+1/-1) mirror/source.py (+12/-12) mirror/source_unittest.py (+13/-13) mirror/trigger.py (+3/-3) mirror/trigger_unittest.py (+8/-8) scheduler/archive_results.py (+2/-2) scheduler/autotest-scheduler (+1/-1) scheduler/autotest-scheduler-watcher (+1/-1) scheduler/drone_manager.py (+10/-10) scheduler/drone_manager_unittest.py (+24/-24) scheduler/drone_utility.py (+7/-7) scheduler/drone_utility_unittest.py (+3/-3) scheduler/drones.py (+4/-4) scheduler/drones_unittest.py (+5/-5) scheduler/email_manager.py (+1/-1) scheduler/gc_stats.py (+3/-3) scheduler/gc_stats_unittest.py (+2/-2) scheduler/host_scheduler.py (+2/-2) scheduler/metahost_scheduler_unittest.py (+3/-3) scheduler/monitor_db.py (+6/-6) scheduler/monitor_db_cleanup_unittest.py (+8/-8) scheduler/monitor_db_functional_unittest.py (+25/-25) scheduler/monitor_db_unittest.py (+45/-45) scheduler/monitor_db_watcher.py (+3/-3) scheduler/scheduler_config.py (+2/-2) scheduler/scheduler_logging_config.py (+1/-1) scheduler/scheduler_models.py (+6/-6) scheduler/scheduler_models_unittest.py (+17/-17) scheduler/setup.py (+1/-1) scheduler/status_server.py (+7/-7) scheduler/watcher_logging_config.py (+1/-1) server/autoserv.py (+7/-7) server/autoserv_parser_unittest.py (+2/-2) server/autotest-remote (+1/-1) server/autotest_remote.py (+11/-11) server/autotest_remote_unittest.py (+7/-7) server/base_utils.py (+4/-4) server/base_utils_unittest.py (+6/-6) server/crashcollect.py (+3/-3) server/deb_kernel_unittest.py (+2/-2) server/frontend.py (+35/-35) server/frontend_unittest.py (+11/-11) server/git_kernel.py (+1/-1) server/hosts/__init__.py (+8/-8) server/hosts/abstract_ssh.py (+11/-11) server/hosts/base_classes_unittest.py (+7/-7) server/hosts/bootloader.py (+3/-3) server/hosts/bootloader_unittest.py (+6/-6) server/hosts/install_server.py (+4/-4) server/hosts/logfile_monitor.py (+4/-4) server/hosts/monitors/console.py (+2/-2) server/hosts/monitors/console_patterns_unittest.py (+7/-7) server/hosts/monitors/console_unittest.py (+4/-4) server/hosts/monitors/followfiles.py (+2/-2) server/hosts/monitors/monitors_util.py (+7/-7) server/hosts/monitors/monitors_util_unittest.py (+23/-23) server/hosts/netconsole.py (+2/-2) server/hosts/paramiko_host.py (+5/-5) server/hosts/remote.py (+5/-5) server/hosts/remote_unittest.py (+2/-2) server/hosts/serial.py (+1/-1) server/hosts/ssh_host.py (+3/-3) server/prebuild.py (+1/-1) server/profiler.py (+3/-3) server/profilers.py (+3/-3) server/rpm_kernel_unittest.py (+5/-5) server/server_job.py (+13/-13) server/server_job_unittest.py (+2/-2) server/server_logging_config.py (+1/-1) server/setup.py (+1/-1) server/site_autoserv_parser.py (+1/-1) server/source_kernel_unittest.py (+2/-2) server/standalone_profiler.py (+2/-2) server/subcommand.py (+16/-16) server/subcommand_unittest.py (+20/-20) setup.py (+12/-12) shared/rpc.py (+1/-1) tko/autotest-db-delete-job (+1/-1) tko/autotest-tko-parse (+1/-1) tko/dbutils.py (+4/-4) tko/job_serializer.py (+10/-10) tko/job_serializer_unittest.py (+9/-9) tko/models.py (+1/-1) tko/parsers/base.py (+3/-3) tko/parsers/test/execute_parser.py (+4/-4) tko/parsers/test/inspect_parser_result_store.py (+7/-7) tko/parsers/test/new_scenario.py (+7/-7) tko/parsers/test/scenario_base.py (+12/-12) tko/parsers/test/templates/base.py (+2/-2) tko/parsers/test/unittest_hotfix.py (+2/-2) tko/parsers/version_0_unittest.py (+60/-60) tko/parsers/version_1.py (+1/-1) tko/parsers/version_1_unittest.py (+68/-68) tko/retrieve_logs.py (+4/-4) tko/setup.py (+1/-1) tko/status_lib.py (+1/-1) tko/status_lib_unittest.py (+35/-35) tko/utils_unittest.py (+12/-12) utils/build_externals.py (+4/-4) utils/check_control_file_vars.py (+14/-14) utils/compile_gwt_clients.py (+5/-5) utils/coverage_suite.py (+2/-2) utils/external_packages.py (+8/-8) utils/modelviz/generate_schema_diagrams.py (+7/-6) utils/packager.py (+10/-10) utils/parallel.py (+4/-4) utils/read_config_var.py (+5/-5) utils/reverify_repair_failed.py (+6/-6) utils/service_helper.py (+3/-3) utils/setup.py (+1/-1) utils/test_importer.py (+5/-5) utils/tko_publish.py (+4/-4) utils/unittest_suite.py (+10/-10) utils/unittest_suite_nose.py (+1/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Canonical Kernel Team | Pending | ||
Review via email:
|
Commit message
Python 2 to 3 conversion
Description of the change
This has been tested with autopkgtest on lunar (testing linux 5.19.0-21.21).
The intent is to maintain this as a fork for lunar testing until we can replace these test suites for avocado implemented versions.
- 2d165be... by Francis Ginther
-
python2to3: Update magic detection to use bytearrays
The file magic detection was modified to read the source file as binary,
which then allows comparisons using bytearrays. This avoids the need to
do any decode operations.Signed-off-by: Francis Ginther <email address hidden>
Acked-by: Andrei Gherzan <email address hidden>
Acked-by: Sean Feole <email address hidden> - 10d61b5... by Francis Ginther
-
python2to3: Allow for unicode replacement when reading from pipes
Add an error handler when decoding command output from pipes. Otherwise
we'll hit UnicodeDecodeError exceptions.Signed-off-by: Francis Ginther <email address hidden>
Acked-by: Andrei Gherzan <email address hidden>
Acked-by: Sean Feole <email address hidden> - 012385c... by Francis Ginther
-
python2to3: Remove use of cmp method when comparing version strings
The version string comparison utility was using the python2 cmp method.
This is no longer available in python3.Signed-off-by: Francis Ginther <email address hidden>
Acked-by: Sean Feole <email address hidden>
Acked-by: Cory Todd <email address hidden>
Unmerged commits
- 012385c... by Francis Ginther
-
python2to3: Remove use of cmp method when comparing version strings
The version string comparison utility was using the python2 cmp method.
This is no longer available in python3.Signed-off-by: Francis Ginther <email address hidden>
Acked-by: Sean Feole <email address hidden>
Acked-by: Cory Todd <email address hidden> - 10d61b5... by Francis Ginther
-
python2to3: Allow for unicode replacement when reading from pipes
Add an error handler when decoding command output from pipes. Otherwise
we'll hit UnicodeDecodeError exceptions.Signed-off-by: Francis Ginther <email address hidden>
Acked-by: Andrei Gherzan <email address hidden>
Acked-by: Sean Feole <email address hidden> - 2d165be... by Francis Ginther
-
python2to3: Update magic detection to use bytearrays
The file magic detection was modified to read the source file as binary,
which then allows comparisons using bytearrays. This avoids the need to
do any decode operations.Signed-off-by: Francis Ginther <email address hidden>
Acked-by: Andrei Gherzan <email address hidden>
Acked-by: Sean Feole <email address hidden> - a473bd2... by Francis Ginther
-
python2to3: Use binary files with pickle
Also removed an obsolete call to `exc_clear`.
Signed-off-by: Francis Ginther <email address hidden>
- a703803... by Francis Ginther
-
python2to3: byte encode data sent to gzip logfile
Signed-off-by: Francis Ginther <email address hidden>
- d13c52c... by Francis Ginther
-
python2to3: don't encode the xml output
After the conversion, the xml file is now handled with regular strings,
no need to do the encoding to bytes.Signed-off-by: Francis Ginther <email address hidden>
- b57401f... by Francis Ginther
-
python2to3: Allow for alternate ordering
The ordering of the results lines are different. Allow for both.
Signed-off-by: Francis Ginther <email address hidden>
- 627f80d... by Francis Ginther
-
python2to3: results are now treated as str
The results file parsed by `results2junit.py` is now read as a python
str, so no need to perform the extra text decoding.Signed-off-by: Francis Ginther <email address hidden>
- 0dae080... by Francis Ginther
-
python2to3: fix relative imports
Signed-off-by: Francis Ginther <email address hidden>
- 8e1c0bd... by Francis Ginther
-
python2to3: Remove duplicate ini config file sections
The python3 config file reader is now more strict about duplicate
sections in ini files.Signed-off-by: Francis Ginther <email address hidden>
Preview Diff
1 | diff --git a/__init__.py b/__init__.py |
2 | index 28fbcb9..5dd3a81 100644 |
3 | --- a/__init__.py |
4 | +++ b/__init__.py |
5 | @@ -1,3 +1,3 @@ |
6 | __all__ = ['client', 'common'] |
7 | -import client |
8 | -import common |
9 | +from . import client |
10 | +from . import common |
11 | diff --git a/cli/acl_unittest.py b/cli/acl_unittest.py |
12 | index 2fe15f2..341bed8 100755 |
13 | --- a/cli/acl_unittest.py |
14 | +++ b/cli/acl_unittest.py |
15 | @@ -1,4 +1,4 @@ |
16 | -#!/usr/bin/python2 |
17 | +#!/usr/bin/python3 |
18 | # |
19 | # Copyright 2008 Google Inc. All Rights Reserved. |
20 | |
21 | @@ -10,7 +10,7 @@ import sys |
22 | try: |
23 | import autotest.common as common |
24 | except ImportError: |
25 | - import common |
26 | + from . import common |
27 | from autotest.cli import topic_common, action_common, acl, cli_mock |
28 | |
29 | |
30 | @@ -45,7 +45,7 @@ class acl_list_unittest(cli_mock.cli_unittest): |
31 | self.assertRaises(cli_mock.ExitException, acl_list.parse) |
32 | (out, err) = self.god.unmock_io() |
33 | self.god.check_playback() |
34 | - self.assert_(err.find('usage')) |
35 | + self.assertTrue(err.find('usage')) |
36 | |
37 | def test_parse_list_acl_user(self): |
38 | sys.argv = ['atest', 'acl0', '-u', 'user'] |
39 | @@ -74,7 +74,7 @@ class acl_list_unittest(cli_mock.cli_unittest): |
40 | def test_execute_list_all_acls(self): |
41 | self.run_cmd(argv=['atest', 'acl', 'list', '-v'], |
42 | rpcs=[('get_acl_groups', {}, True, |
43 | - [{'id': 1L, |
44 | + [{'id': 1, |
45 | 'name': 'Everyone', |
46 | 'description': '', |
47 | 'users': ['debug_user'], |
48 | @@ -84,7 +84,7 @@ class acl_list_unittest(cli_mock.cli_unittest): |
49 | def test_execute_list_acls_for_acl(self): |
50 | self.run_cmd(argv=['atest', 'acl', 'list', 'acl0'], |
51 | rpcs=[('get_acl_groups', {'name__in': ['acl0']}, True, |
52 | - [{'id': 1L, |
53 | + [{'id': 1, |
54 | 'name': 'Everyone', |
55 | 'description': '', |
56 | 'users': ['user0'], |
57 | @@ -94,7 +94,7 @@ class acl_list_unittest(cli_mock.cli_unittest): |
58 | def test_execute_list_acls_for_user(self): |
59 | self.run_cmd(argv=['atest', 'acl', 'list', '-v', '--user', 'user0'], |
60 | rpcs=[('get_acl_groups', {'users__login': 'user0'}, True, |
61 | - [{'id': 1L, |
62 | + [{'id': 1, |
63 | 'name': 'Everyone', |
64 | 'description': '', |
65 | 'users': ['user0'], |
66 | @@ -105,7 +105,7 @@ class acl_list_unittest(cli_mock.cli_unittest): |
67 | self.run_cmd(argv=['atest', 'acl', 'list', '-m', 'host0'], |
68 | rpcs=[('get_acl_groups', {'hosts__hostname': 'host0'}, |
69 | True, |
70 | - [{'id': 1L, |
71 | + [{'id': 1, |
72 | 'name': 'Everyone', |
73 | 'description': '', |
74 | 'users': ['user0'], |
75 | @@ -117,7 +117,7 @@ class acl_list_unittest(cli_mock.cli_unittest): |
76 | self.run_cmd(argv=['atest', 'acl', 'list', '-m', 'host0', '-v'], |
77 | rpcs=[('get_acl_groups', {'hosts__hostname': 'host0'}, |
78 | True, |
79 | - [{'id': 1L, |
80 | + [{'id': 1, |
81 | 'name': 'Everyone', |
82 | 'description': '', |
83 | 'users': ['user0'], |
84 | @@ -169,7 +169,7 @@ class acl_create_unittest(cli_mock.cli_unittest): |
85 | {'description': 'my_favorite_acl', |
86 | 'name': 'acl0'}, |
87 | True, |
88 | - 3L)], |
89 | + 3)], |
90 | out_words_ok=['acl0']) |
91 | |
92 | def test_acl_create_duplicate_acl(self): |
93 | diff --git a/cli/action_common.py b/cli/action_common.py |
94 | index ae0784a..062498a 100644 |
95 | --- a/cli/action_common.py |
96 | +++ b/cli/action_common.py |
97 | @@ -76,13 +76,13 @@ class atest_list(topic_common.atest): |
98 | def check_for_wildcard(self, filters, check_results): |
99 | """Check if there is a wilcard (only * for the moment) |
100 | and replace the request appropriately""" |
101 | - for (key, values) in filters.iteritems(): |
102 | - if isinstance(values, types.StringTypes): |
103 | + for (key, values) in filters.items(): |
104 | + if isinstance(values, (str,)): |
105 | self._convert_name_wildcard(key, values, |
106 | filters, check_results) |
107 | continue |
108 | |
109 | - if isinstance(values, types.ListType): |
110 | + if isinstance(values, list): |
111 | if len(values) == 1: |
112 | self._convert_in_wildcard(key, values[0], |
113 | filters, check_results) |
114 | @@ -104,7 +104,7 @@ class atest_list(topic_common.atest): |
115 | |
116 | results = self.execute_rpc(op, **filters) |
117 | |
118 | - for dbkey in filters.keys(): |
119 | + for dbkey in list(filters.keys()): |
120 | if not check_results.get(dbkey, None): |
121 | # Don't want to check the results |
122 | # for this key |
123 | @@ -205,7 +205,7 @@ class atest_add_or_remove(topic_common.atest): |
124 | self.execute_rpc(op=op, # The opcode |
125 | **{'id': item, what: uhs}) # The data |
126 | setattr(self, 'good_%s' % what, uhs) |
127 | - except topic_common.CliError, full_error: |
128 | + except topic_common.CliError as full_error: |
129 | bad_uhs = self.parse_json_exception(full_error) |
130 | good_uhs = list(set(uhs) - set(bad_uhs)) |
131 | if bad_uhs and good_uhs: |
132 | @@ -242,7 +242,7 @@ class atest_add_or_remove(topic_common.atest): |
133 | self._add_remove_uh_to_topic(item, what) |
134 | except AttributeError: |
135 | pass |
136 | - except topic_common.CliError, err: |
137 | + except topic_common.CliError as err: |
138 | # The error was already logged by |
139 | # self.failure() |
140 | pass |
141 | @@ -251,13 +251,13 @@ class atest_add_or_remove(topic_common.atest): |
142 | |
143 | results = {} |
144 | for thing in self.add_remove_things: |
145 | - things_ok = [item for item, what in oks.items() if thing in what] |
146 | + things_ok = [item for item, what in list(oks.items()) if thing in what] |
147 | results[thing] = things_ok |
148 | |
149 | return results |
150 | |
151 | def output(self, results): |
152 | - for thing, single_thing in self.add_remove_things.iteritems(): |
153 | + for thing, single_thing in self.add_remove_things.items(): |
154 | # Enclose each of the elements in a single quote. |
155 | things_ok = ["'%s'" % t for t in results[thing]] |
156 | if things_ok: |
157 | diff --git a/cli/action_common_unittest.py b/cli/action_common_unittest.py |
158 | index 7cfc336..7b4d70f 100755 |
159 | --- a/cli/action_common_unittest.py |
160 | +++ b/cli/action_common_unittest.py |
161 | @@ -1,4 +1,4 @@ |
162 | -#!/usr/bin/python2 |
163 | +#!/usr/bin/python3 |
164 | # |
165 | # Copyright 2008 Google Inc. All Rights Reserved. |
166 | |
167 | @@ -11,7 +11,7 @@ import copy |
168 | try: |
169 | import autotest.common as common |
170 | except ImportError: |
171 | - import common |
172 | + from . import common |
173 | from autotest.cli import cli_mock, action_common, rpc |
174 | |
175 | # |
176 | @@ -88,16 +88,16 @@ class atest_list_unittest(cli_mock.cli_unittest): |
177 | self.assertEqual(checks, orig_checks) |
178 | |
179 | def _atest_list_execute(self, filters={}, check_results={}): |
180 | - values = [{u'id': 180, |
181 | - u'platform': 0, |
182 | - u'name': u'label0', |
183 | - u'invalid': 0, |
184 | - u'kernel_config': u''}, |
185 | - {u'id': 338, |
186 | - u'platform': 0, |
187 | - u'name': u'label1', |
188 | - u'invalid': 0, |
189 | - u'kernel_config': u''}] |
190 | + values = [{'id': 180, |
191 | + 'platform': 0, |
192 | + 'name': 'label0', |
193 | + 'invalid': 0, |
194 | + 'kernel_config': ''}, |
195 | + {'id': 338, |
196 | + 'platform': 0, |
197 | + 'name': 'label1', |
198 | + 'invalid': 0, |
199 | + 'kernel_config': ''}] |
200 | mytest = action_common.atest_list() |
201 | mytest.afe = rpc.afe_comm() |
202 | self.mock_rpcs([('get_labels', |
203 | @@ -131,8 +131,8 @@ class atest_list_unittest(cli_mock.cli_unittest): |
204 | filters['name__in'] = ['label0', 'label1', 'label2'] |
205 | check_results['name__in'] = 'name' |
206 | (out, err, errors) = self._atest_list_execute(filters, check_results) |
207 | - K = errors.keys()[0] |
208 | - V = errors.values()[0].keys()[0] |
209 | + K = list(errors.keys())[0] |
210 | + V = list(errors.values())[0].keys()[0] |
211 | self.assertTrue('Unknown' in K) |
212 | self.assertTrue('label2' in V) |
213 | |
214 | @@ -149,16 +149,16 @@ class atest_list_unittest(cli_mock.cli_unittest): |
215 | check_results = {} |
216 | filters['name__in'] = ['label*'] |
217 | check_results['name__in'] = 'name' |
218 | - values = [{u'id': 180, |
219 | - u'platform': False, |
220 | - u'name': u'label0', |
221 | - u'invalid': False, |
222 | - u'kernel_config': u''}, |
223 | - {u'id': 338, |
224 | - u'platform': False, |
225 | - u'name': u'label1', |
226 | - u'invalid': False, |
227 | - u'kernel_config': u''}] |
228 | + values = [{'id': 180, |
229 | + 'platform': False, |
230 | + 'name': 'label0', |
231 | + 'invalid': False, |
232 | + 'kernel_config': ''}, |
233 | + {'id': 338, |
234 | + 'platform': False, |
235 | + 'name': 'label1', |
236 | + 'invalid': False, |
237 | + 'kernel_config': ''}] |
238 | mytest = action_common.atest_list() |
239 | mytest.afe = rpc.afe_comm() |
240 | self.mock_rpcs([('get_labels', {'name__startswith': 'label'}, |
241 | @@ -198,7 +198,7 @@ class atest_create_or_delete_unittest(cli_mock.cli_unittest): |
242 | True, 42)]) |
243 | ret = acr.execute() |
244 | self.god.check_playback() |
245 | - self.assert_(['label0'], ret) |
246 | + self.assertTrue(['label0'], ret) |
247 | |
248 | def test_execute_create_two_topics(self): |
249 | acr = self._create_cr_del(['label0', 'label1']) |
250 | diff --git a/cli/atest.py b/cli/atest.py |
251 | index 1525cac..5348da4 100644 |
252 | --- a/cli/atest.py |
253 | +++ b/cli/atest.py |
254 | @@ -51,7 +51,7 @@ import traceback |
255 | try: |
256 | import autotest.common as common |
257 | except ImportError: |
258 | - import common |
259 | + from . import common |
260 | from autotest.cli import topic_common |
261 | |
262 | |
263 | @@ -128,7 +128,7 @@ def main(): |
264 | results = action_obj.execute() |
265 | except topic_common.CliError: |
266 | pass |
267 | - except Exception, err: |
268 | + except Exception as err: |
269 | traceback.print_exc() |
270 | action_obj.generic_error("Unexpected exception: %s" % err) |
271 | else: |
272 | diff --git a/cli/atest_unittest.py b/cli/atest_unittest.py |
273 | index 62ee817..7de0f5a 100755 |
274 | --- a/cli/atest_unittest.py |
275 | +++ b/cli/atest_unittest.py |
276 | @@ -1,4 +1,4 @@ |
277 | -#!/usr/bin/python2 |
278 | +#!/usr/bin/python3 |
279 | # |
280 | # Copyright 2008 Google Inc. All Rights Reserved. |
281 | |
282 | @@ -7,12 +7,12 @@ |
283 | import unittest |
284 | import os |
285 | import sys |
286 | -import StringIO |
287 | +import io |
288 | |
289 | try: |
290 | import autotest.common as common |
291 | except ImportError: |
292 | - import common |
293 | + from . import common |
294 | from autotest.cli import cli_mock |
295 | |
296 | |
297 | diff --git a/cli/atomicgroup_unittest.py b/cli/atomicgroup_unittest.py |
298 | index f08f10e..12ee6cf 100755 |
299 | --- a/cli/atomicgroup_unittest.py |
300 | +++ b/cli/atomicgroup_unittest.py |
301 | @@ -1,4 +1,4 @@ |
302 | -#!/usr/bin/python2 -u |
303 | +#!/usr/bin/python3 -u |
304 | |
305 | """Tests for atomicgroup.""" |
306 | |
307 | @@ -7,7 +7,7 @@ import unittest |
308 | try: |
309 | import autotest.common as common |
310 | except ImportError: |
311 | - import common |
312 | + from . import common |
313 | from autotest.cli import cli_mock, topic_common, atomicgroup |
314 | |
315 | |
316 | diff --git a/cli/autotest-rpc-change-protection-level b/cli/autotest-rpc-change-protection-level |
317 | index d40e979..0f4485a 100755 |
318 | --- a/cli/autotest-rpc-change-protection-level |
319 | +++ b/cli/autotest-rpc-change-protection-level |
320 | @@ -1,4 +1,4 @@ |
321 | -#!/usr/bin/python2 |
322 | +#!/usr/bin/python3 |
323 | |
324 | # change_protection_level.py "No protection" machine1 machine2 machine3 |
325 | |
326 | diff --git a/cli/autotest-rpc-client b/cli/autotest-rpc-client |
327 | index 60dd909..80087cc 100755 |
328 | --- a/cli/autotest-rpc-client |
329 | +++ b/cli/autotest-rpc-client |
330 | @@ -1,4 +1,4 @@ |
331 | -#!/usr/bin/python2 -u |
332 | +#!/usr/bin/python3 -u |
333 | |
334 | import sys |
335 | try: |
336 | diff --git a/cli/autotest-rpc-migrate-host b/cli/autotest-rpc-migrate-host |
337 | index 5374ab9..28ee58e 100755 |
338 | --- a/cli/autotest-rpc-migrate-host |
339 | +++ b/cli/autotest-rpc-migrate-host |
340 | @@ -1,4 +1,4 @@ |
341 | -#!/usr/bin/python2 |
342 | +#!/usr/bin/python3 |
343 | # Copyright Google, Martin J. Bligh <mbligh@google.com>, Jan 2009 |
344 | import os |
345 | import sys |
346 | diff --git a/cli/autotest-rpc-query-keyvals b/cli/autotest-rpc-query-keyvals |
347 | index e0a0306..efc296f 100755 |
348 | --- a/cli/autotest-rpc-query-keyvals |
349 | +++ b/cli/autotest-rpc-query-keyvals |
350 | @@ -1,4 +1,4 @@ |
351 | -#!/usr/bin/python2 |
352 | +#!/usr/bin/python3 |
353 | |
354 | import sys |
355 | import optparse |
356 | diff --git a/cli/autotest-rpc-query-results b/cli/autotest-rpc-query-results |
357 | index 462a6b9..692b242 100755 |
358 | --- a/cli/autotest-rpc-query-results |
359 | +++ b/cli/autotest-rpc-query-results |
360 | @@ -1,4 +1,4 @@ |
361 | -#!/usr/bin/python2 |
362 | +#!/usr/bin/python3 |
363 | """ |
364 | Selects all rows and columns that satisfy the condition specified |
365 | and prints the matrix. |
366 | diff --git a/cli/cli_mock.py b/cli/cli_mock.py |
367 | index 0c69f0f..7fb56cd 100644 |
368 | --- a/cli/cli_mock.py |
369 | +++ b/cli/cli_mock.py |
370 | @@ -6,12 +6,12 @@ |
371 | import unittest |
372 | import os |
373 | import sys |
374 | -import StringIO |
375 | +import io |
376 | |
377 | try: |
378 | import autotest.common as common |
379 | except ImportError: |
380 | - import common |
381 | + from . import common |
382 | from autotest.cli import atest, topic_common, rpc |
383 | from autotest.frontend.afe import rpc_client_lib |
384 | from autotest.frontend.afe.json_rpc import proxy |
385 | @@ -54,10 +54,10 @@ class cli_unittest(unittest.TestCase): |
386 | |
387 | def assertWords(self, string, to_find=[], not_in=[]): |
388 | for word in to_find: |
389 | - self.assert_(string.find(word) >= 0, |
390 | + self.assertTrue(string.find(word) >= 0, |
391 | "Could not find '%s' in: %s" % (word, string)) |
392 | for word in not_in: |
393 | - self.assert_(string.find(word) < 0, |
394 | + self.assertTrue(string.find(word) < 0, |
395 | "Found (and shouldn't have) '%s' in: %s" % (word, |
396 | string)) |
397 | |
398 | diff --git a/cli/contrib/why_isnt_my_job_running.py b/cli/contrib/why_isnt_my_job_running.py |
399 | index 9bc7e4f..0b59b56 100755 |
400 | --- a/cli/contrib/why_isnt_my_job_running.py |
401 | +++ b/cli/contrib/why_isnt_my_job_running.py |
402 | @@ -1,4 +1,4 @@ |
403 | -#!/usr/bin/python2 |
404 | +#!/usr/bin/python3 |
405 | |
406 | import sys |
407 | import optparse |
408 | @@ -29,7 +29,7 @@ proxy = rpc.afe_comm(autotest_host) |
409 | # job exists? |
410 | jobs = proxy.run('get_jobs', id=job_id) |
411 | if not jobs: |
412 | - print 'No such job', job_id |
413 | + print('No such job', job_id) |
414 | sys.exit(1) |
415 | job = jobs[0] |
416 | owner = job['owner'] |
417 | @@ -42,8 +42,8 @@ queue_entries = proxy.run('get_host_queue_entries', job__id=job_id) |
418 | # Divine why an atomic group job is or is not running. |
419 | if queue_entries and queue_entries[0]['atomic_group']: |
420 | if queue_entries[0]['status'] in RUNNING_HQE_STATUSES: |
421 | - print 'Job %d appears to have started (status: %s).' % ( |
422 | - job_id, queue_entries[0]['status']) |
423 | + print('Job %d appears to have started (status: %s).' % ( |
424 | + job_id, queue_entries[0]['status'])) |
425 | sys.exit(0) |
426 | # Hosts in Repairing or Repair Failed will have Queued queue entries. |
427 | # We shouldn't consider those queue entries as a multi-group job. |
428 | @@ -53,7 +53,7 @@ if queue_entries and queue_entries[0]['atomic_group']: |
429 | if queue_entry['host']['status'].startswith('Repair'): |
430 | repair_hostnames.append(queue_entry['host']['hostname']) |
431 | if queue_entry['status'] in ('Completed', 'Stopped'): |
432 | - print 'This job has already finished.' |
433 | + print('This job has already finished.') |
434 | sys.exit(0) |
435 | queue_entries_with_hosts = [queue_entry for queue_entry in queue_entries |
436 | if queue_entry['host']] |
437 | @@ -66,25 +66,25 @@ if queue_entries and queue_entries[0]['atomic_group']: |
438 | # but is not running because too many of them are in Repairing or will |
439 | # never run because hosts have exited Repairing into the Repair Failed |
440 | # dead end. |
441 | - print 'This script does not support multi-group atomic group jobs.' |
442 | |
443 | - print 'Jobs scheduled in that state are typically unintentional.' |
444 | |
445 | - print 'Did you perhaps schedule the job via the web frontend and ask' |
446 | - print 'that it run on more than 1 (atomic group) of hosts via the ' |
447 | - print '"Run on any" box? If so, always enter 1 there when scheduling' |
448 | - print 'jobs on anything marked "(atomic group)".' |
449 | |
450 | - print len(queue_entries), 'non-started atomic group HostQueueEntries', |
451 | - print 'found for job', job_id |
452 | + print('This script does not support multi-group atomic group jobs.') |
453 | + print() |
454 | + print('Jobs scheduled in that state are typically unintentional.') |
455 | + print() |
456 | + print('Did you perhaps schedule the job via the web frontend and ask') |
457 | + print('that it run on more than 1 (atomic group) of hosts via the ') |
458 | + print('"Run on any" box? If so, always enter 1 there when scheduling') |
459 | + print('jobs on anything marked "(atomic group)".') |
460 | + print() |
461 | + print(len(queue_entries), 'non-started atomic group HostQueueEntries', end=' ') |
462 | + print('found for job', job_id) |
463 | sys.exit(1) |
464 | atomic_group_name = queue_entries[0]['atomic_group']['name'] |
465 | # Get the list of labels associated with this atomic group. |
466 | atomic_labels = proxy.run('get_labels', |
467 | atomic_group__name=atomic_group_name) |
468 | if len(atomic_labels) < 1: |
469 | - print 'Job requests atomic group %s but no labels' % atomic_group_name |
470 | - print '(and thus no hosts) are associated with that atomic group.' |
471 | + print('Job requests atomic group %s but no labels' % atomic_group_name) |
472 | + print('(and thus no hosts) are associated with that atomic group.') |
473 | |
474 | job_sync_count = job['synch_count'] |
475 | # Ugh! This is returned as a comma separated str of label names. |
476 | @@ -110,16 +110,16 @@ if queue_entries and queue_entries[0]['atomic_group']: |
477 | for label in atomic_labels: |
478 | label_name = label['name'] |
479 | if meta_host and meta_host_name != label_name: |
480 | - print 'Cannot run on atomic label %s due to meta_host %s.' % ( |
481 | - label_name, meta_host_name) |
482 | + print('Cannot run on atomic label %s due to meta_host %s.' % ( |
483 | + label_name, meta_host_name)) |
484 | continue |
485 | for dep_name in job_dependency_label_names: |
486 | if dep_name != label_name: |
487 | - print 'Not checking hosts in atomic label %s against' % ( |
488 | - label_name,) |
489 | - print 'job dependency label %s. There may be less hosts' % ( |
490 | - dep_name,) |
491 | - print 'than examined below available to run this job.' |
492 | + print('Not checking hosts in atomic label %s against' % ( |
493 | + label_name,)) |
494 | + print('job dependency label %s. There may be less hosts' % ( |
495 | + dep_name,)) |
496 | + print('than examined below available to run this job.') |
497 | |
498 | # Get the list of hosts associated with this atomic group label. |
499 | atomic_hosts = proxy.run('get_hosts', multiple_labels=[label_name]) |
500 | @@ -186,22 +186,22 @@ if queue_entries and queue_entries[0]['atomic_group']: |
501 | else: |
502 | runnable_atomic_label_names[label_name] = usable_hostnames |
503 | |
504 | - for label_name, reason_tuple in atomic_label_exclude_reasons.iteritems(): |
505 | + for label_name, reason_tuple in atomic_label_exclude_reasons.items(): |
506 | job_reason, hosts_reasons = reason_tuple |
507 | - print 'Atomic group "%s" via label "%s" CANNOT run job %d because:' % ( |
508 | - atomic_group_name, label_name, job_id) |
509 | - print job_reason |
510 | + print('Atomic group "%s" via label "%s" CANNOT run job %d because:' % ( |
511 | + atomic_group_name, label_name, job_id)) |
512 | + print(job_reason) |
513 | for hostname in sorted(hosts_reasons.keys()): |
514 | for reason in hosts_reasons[hostname]: |
515 | - print '%s\t%s' % (hostname, reason) |
516 | |
517 | + print('%s\t%s' % (hostname, reason)) |
518 | + print() |
519 | |
520 | - for label_name, host_list in runnable_atomic_label_names.iteritems(): |
521 | - print 'Atomic group "%s" via label "%s" is READY to run job %d on:' % ( |
522 | - atomic_group_name, label_name, job_id) |
523 | - print ', '.join(host_list) |
524 | - print 'Is the job scheduler healthy?' |
525 | |
526 | + for label_name, host_list in runnable_atomic_label_names.items(): |
527 | + print('Atomic group "%s" via label "%s" is READY to run job %d on:' % ( |
528 | + atomic_group_name, label_name, job_id)) |
529 | + print(', '.join(host_list)) |
530 | + print('Is the job scheduler healthy?') |
531 | + print() |
532 | |
533 | sys.exit(0) |
534 | |
535 | @@ -213,7 +213,7 @@ if len(args) != 2: |
536 | hostname = queue_entries[0]['host']['hostname'] |
537 | else: |
538 | parser.print_help() |
539 | - print '\nERROR: A hostname associated with the job is required.' |
540 | + print('\nERROR: A hostname associated with the job is required.') |
541 | sys.exit(1) |
542 | else: |
543 | hostname = args[1] |
544 | @@ -221,7 +221,7 @@ else: |
545 | # host exists? |
546 | hosts = proxy.run('get_hosts', hostname=hostname) |
547 | if not hosts: |
548 | - print 'No such host', hostname |
549 | + print('No such host', hostname) |
550 | sys.exit(1) |
551 | host = hosts[0] |
552 | |
553 | @@ -243,8 +243,8 @@ if entries_for_this_host: |
554 | 'Multiple entries for this job assigned to this host!') |
555 | entry = entries_for_this_host[0] |
556 | if entry['active'] or entry['complete']: |
557 | - print ('Job already ran or is running on this host! (status: %s)' % |
558 | - entry['full_status']) |
559 | + print(('Job already ran or is running on this host! (status: %s)' % |
560 | + entry['full_status'])) |
561 | sys.exit(0) |
562 | is_metahost = False |
563 | else: |
564 | @@ -265,8 +265,8 @@ if host_atomic_group_labels: |
565 | for label in host_atomic_group_labels: |
566 | atomic_groups.add(label['atomic_group']['name']) |
567 | if len(atomic_groups) != 1: |
568 | - print 'Host has more than one atomic group!' |
569 | - print list(atomic_groups) |
570 | + print('Host has more than one atomic group!') |
571 | + print(list(atomic_groups)) |
572 | sys.exit(1) |
573 | host_atomic_group_label = host_atomic_group_labels[0] |
574 | host_atomic_group_name = host_atomic_group_label['atomic_group']['name'] |
575 | @@ -279,15 +279,15 @@ if job_atomic_group: |
576 | job_atomic_group_name = job_atomic_group['name'] |
577 | |
578 | if host_atomic_group_name != job_atomic_group_name: |
579 | - print ('Job is for atomic group %s, but host is in atomic group %s ' |
580 | + print(('Job is for atomic group %s, but host is in atomic group %s ' |
581 | '(label %s)' % |
582 | (job_atomic_group_name, host_atomic_group_name, |
583 | - host_atomic_group_label['name'])) |
584 | + host_atomic_group_label['name']))) |
585 | job_will_run = False |
586 | |
587 | # host locked? |
588 | if host['locked']: |
589 | - print 'Host is locked by', host['locked_by'], 'no jobs will schedule on it.' |
590 | + print('Host is locked by', host['locked_by'], 'no jobs will schedule on it.') |
591 | job_will_run = False |
592 | |
593 | # acl accessible? |
594 | @@ -298,9 +298,9 @@ if not accessible: |
595 | proxy.run('get_acl_groups', hosts__hostname=hostname)) |
596 | owner_acls = ', '.join(group['name'] for group in |
597 | proxy.run('get_acl_groups', users__login=owner)) |
598 | - print 'Host not ACL-accessible to job owner', owner |
599 | - print ' Host ACLs:', host_acls |
600 | - print ' Owner Acls:', owner_acls |
601 | + print('Host not ACL-accessible to job owner', owner) |
602 | + print(' Host ACLs:', host_acls) |
603 | + print(' Owner Acls:', owner_acls) |
604 | job_will_run = False |
605 | |
606 | # meets dependencies? |
607 | @@ -310,8 +310,8 @@ if job_deps_list != ['']: |
608 | job_deps = set(job_deps_list) |
609 | unmet = job_deps - host_label_names |
610 | if unmet: |
611 | - print ("Host labels (%s) don't satisfy job dependencies: %s" % |
612 | - (', '.join(host_label_names), ', '.join(unmet))) |
613 | + print(("Host labels (%s) don't satisfy job dependencies: %s" % |
614 | + (', '.join(host_label_names), ', '.join(unmet)))) |
615 | job_will_run = False |
616 | |
617 | # at this point, if the job is for an unassigned atomic group, things are too |
618 | @@ -333,8 +333,8 @@ if is_metahost: |
619 | unmet_exclusive_label = (label['only_if_needed'] and |
620 | label['name'] not in job_deps_and_metahosts) |
621 | if unmet_exclusive_label: |
622 | - print ('Host contains "only if needed" label %s, unused by job ' |
623 | - 'dependencies and metahosts' % label['name']) |
624 | + print(('Host contains "only if needed" label %s, unused by job ' |
625 | + 'dependencies and metahosts' % label['name'])) |
626 | job_will_run = False |
627 | |
628 | # host ready? |
629 | @@ -343,17 +343,17 @@ if host['status'] != 'Ready': |
630 | active = proxy.run('get_host_queue_entries', |
631 | host=host['id'], active=True) |
632 | if not active: |
633 | - print ('Host %s seems to be in "Pending" state incorrectly; please ' |
634 | - 'report this to the Autotest team' % hostname) |
635 | + print(('Host %s seems to be in "Pending" state incorrectly; please ' |
636 | + 'report this to the Autotest team' % hostname)) |
637 | sys.exit(1) |
638 | - print 'Host not in "Ready" status (status="%s")' % host['status'] |
639 | + print('Host not in "Ready" status (status="%s")' % host['status']) |
640 | job_will_run = False |
641 | |
642 | if job_will_run: |
643 | - print ("Job %s should run on host %s; if you've already waited about ten " |
644 | + print(("Job %s should run on host %s; if you've already waited about ten " |
645 | "minutes or longer, it's probably a server issue or a bug." % |
646 | - (job_id, hostname)) |
647 | + (job_id, hostname))) |
648 | sys.exit(1) |
649 | else: |
650 | - print "All of the reasons this job is not running are listed above." |
651 | + print("All of the reasons this job is not running are listed above.") |
652 | sys.exit(0) |
653 | diff --git a/cli/host.py b/cli/host.py |
654 | index 24be9af..e0927fd 100644 |
655 | --- a/cli/host.py |
656 | +++ b/cli/host.py |
657 | @@ -232,7 +232,7 @@ class host_stat(host): |
658 | |
659 | def output(self, results): |
660 | for stats, acls, labels in results: |
661 | - print '-' * 5 |
662 | + print('-' * 5) |
663 | self.print_fields(stats, |
664 | keys=['hostname', 'platform', |
665 | 'status', 'locked', 'locked_by', |
666 | @@ -291,8 +291,8 @@ class host_jobs(host): |
667 | |
668 | def output(self, results): |
669 | for host, jobs in results: |
670 | - print '-' * 5 |
671 | - print 'Hostname: %s' % host |
672 | + print('-' * 5) |
673 | + print('Hostname: %s' % host) |
674 | self.print_table(jobs, keys_header=['job_id', |
675 | 'job_owner', |
676 | 'job_name', |
677 | @@ -346,7 +346,7 @@ class host_mod(host): |
678 | # TODO: Make the AFE return True or False, |
679 | # especially for lock |
680 | successes.append(host) |
681 | - except topic_common.CliError, full_error: |
682 | + except topic_common.CliError as full_error: |
683 | # Already logged by execute_rpc() |
684 | pass |
685 | |
686 | diff --git a/cli/host_unittest.py b/cli/host_unittest.py |
687 | index 7d67791..bbcfd40 100755 |
688 | --- a/cli/host_unittest.py |
689 | +++ b/cli/host_unittest.py |
690 | @@ -1,4 +1,4 @@ |
691 | -#!/usr/bin/python2 |
692 | +#!/usr/bin/python3 |
693 | # |
694 | # Copyright 2008 Google Inc. All Rights Reserved. |
695 | |
696 | @@ -11,7 +11,7 @@ import sys |
697 | try: |
698 | import autotest.common as common |
699 | except ImportError: |
700 | - import common |
701 | + from . import common |
702 | from autotest.cli import cli_mock, host |
703 | |
704 | |
705 | @@ -113,26 +113,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
706 | self.run_cmd(argv=['atest', 'host', 'list', '--ignore_site_file'], |
707 | rpcs=[('get_hosts', {}, |
708 | True, |
709 | - [{u'status': u'Ready', |
710 | - u'hostname': u'host0', |
711 | - u'locked': False, |
712 | - u'locked_by': 'user0', |
713 | - u'lock_time': u'2008-07-23 12:54:15', |
714 | - u'labels': [], |
715 | - u'invalid': False, |
716 | - u'synch_id': None, |
717 | - u'platform': None, |
718 | - u'id': 1}, |
719 | - {u'status': u'Ready', |
720 | - u'hostname': u'host1', |
721 | - u'locked': True, |
722 | - u'locked_by': 'user0', |
723 | - u'lock_time': u'2008-07-23 12:54:15', |
724 | - u'labels': [u'plat1'], |
725 | - u'invalid': False, |
726 | - u'synch_id': None, |
727 | - u'platform': u'plat1', |
728 | - u'id': 2}])], |
729 | + [{'status': 'Ready', |
730 | + 'hostname': 'host0', |
731 | + 'locked': False, |
732 | + 'locked_by': 'user0', |
733 | + 'lock_time': '2008-07-23 12:54:15', |
734 | + 'labels': [], |
735 | + 'invalid': False, |
736 | + 'synch_id': None, |
737 | + 'platform': None, |
738 | + 'id': 1}, |
739 | + {'status': 'Ready', |
740 | + 'hostname': 'host1', |
741 | + 'locked': True, |
742 | + 'locked_by': 'user0', |
743 | + 'lock_time': '2008-07-23 12:54:15', |
744 | + 'labels': ['plat1'], |
745 | + 'invalid': False, |
746 | + 'synch_id': None, |
747 | + 'platform': 'plat1', |
748 | + 'id': 2}])], |
749 | out_words_ok=['host0', 'host1', 'Ready', |
750 | 'plat1', 'False', 'True']) |
751 | |
752 | @@ -140,26 +140,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
753 | self.run_cmd(argv=['atest', 'host', 'list', '--ignore_site_file'], |
754 | rpcs=[('get_hosts', {}, |
755 | True, |
756 | - [{u'status': u'Ready', |
757 | - u'hostname': u'host0', |
758 | - u'locked': False, |
759 | - u'locked_by': 'user0', |
760 | - u'lock_time': u'2008-07-23 12:54:15', |
761 | - u'labels': [u'label0', u'label1'], |
762 | - u'invalid': False, |
763 | - u'synch_id': None, |
764 | - u'platform': None, |
765 | - u'id': 1}, |
766 | - {u'status': u'Ready', |
767 | - u'hostname': u'host1', |
768 | - u'locked': True, |
769 | - u'locked_by': 'user0', |
770 | - u'lock_time': u'2008-07-23 12:54:15', |
771 | - u'labels': [u'label2', u'label3', u'plat1'], |
772 | - u'invalid': False, |
773 | - u'synch_id': None, |
774 | - u'platform': u'plat1', |
775 | - u'id': 2}])], |
776 | + [{'status': 'Ready', |
777 | + 'hostname': 'host0', |
778 | + 'locked': False, |
779 | + 'locked_by': 'user0', |
780 | + 'lock_time': '2008-07-23 12:54:15', |
781 | + 'labels': ['label0', 'label1'], |
782 | + 'invalid': False, |
783 | + 'synch_id': None, |
784 | + 'platform': None, |
785 | + 'id': 1}, |
786 | + {'status': 'Ready', |
787 | + 'hostname': 'host1', |
788 | + 'locked': True, |
789 | + 'locked_by': 'user0', |
790 | + 'lock_time': '2008-07-23 12:54:15', |
791 | + 'labels': ['label2', 'label3', 'plat1'], |
792 | + 'invalid': False, |
793 | + 'synch_id': None, |
794 | + 'platform': 'plat1', |
795 | + 'id': 2}])], |
796 | out_words_ok=['host0', 'host1', 'Ready', 'plat1', |
797 | 'label0', 'label1', 'label2', 'label3', |
798 | 'False', 'True']) |
799 | @@ -169,16 +169,16 @@ class host_list_unittest(cli_mock.cli_unittest): |
800 | '--ignore_site_file'], |
801 | rpcs=[('get_hosts', {'hostname__in': ['host1']}, |
802 | True, |
803 | - [{u'status': u'Ready', |
804 | - u'hostname': u'host1', |
805 | - u'locked': True, |
806 | - u'locked_by': 'user0', |
807 | - u'lock_time': u'2008-07-23 12:54:15', |
808 | - u'labels': [u'label2', u'label3', u'plat1'], |
809 | - u'invalid': False, |
810 | - u'synch_id': None, |
811 | - u'platform': u'plat1', |
812 | - u'id': 2}])], |
813 | + [{'status': 'Ready', |
814 | + 'hostname': 'host1', |
815 | + 'locked': True, |
816 | + 'locked_by': 'user0', |
817 | + 'lock_time': '2008-07-23 12:54:15', |
818 | + 'labels': ['label2', 'label3', 'plat1'], |
819 | + 'invalid': False, |
820 | + 'synch_id': None, |
821 | + 'platform': 'plat1', |
822 | + 'id': 2}])], |
823 | out_words_ok=['host1', 'Ready', 'plat1', |
824 | 'label2', 'label3', 'True'], |
825 | out_words_no=['host0', 'host2', |
826 | @@ -191,26 +191,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
827 | # This is a bit fragile as the list order may change... |
828 | rpcs=[('get_hosts', {'hostname__in': ['host2', 'host1']}, |
829 | True, |
830 | - [{u'status': u'Ready', |
831 | - u'hostname': u'host1', |
832 | - u'locked': True, |
833 | - u'locked_by': 'user0', |
834 | - u'lock_time': u'2008-07-23 12:54:15', |
835 | - u'labels': [u'label2', u'label3', u'plat1'], |
836 | - u'invalid': False, |
837 | - u'synch_id': None, |
838 | - u'platform': u'plat1', |
839 | - u'id': 2}, |
840 | - {u'status': u'Ready', |
841 | - u'hostname': u'host2', |
842 | - u'locked': True, |
843 | - u'locked_by': 'user0', |
844 | - u'lock_time': u'2008-07-23 12:54:15', |
845 | - u'labels': [u'label3', u'label4', u'plat1'], |
846 | - u'invalid': False, |
847 | - u'synch_id': None, |
848 | - u'platform': u'plat1', |
849 | - u'id': 3}])], |
850 | + [{'status': 'Ready', |
851 | + 'hostname': 'host1', |
852 | + 'locked': True, |
853 | + 'locked_by': 'user0', |
854 | + 'lock_time': '2008-07-23 12:54:15', |
855 | + 'labels': ['label2', 'label3', 'plat1'], |
856 | + 'invalid': False, |
857 | + 'synch_id': None, |
858 | + 'platform': 'plat1', |
859 | + 'id': 2}, |
860 | + {'status': 'Ready', |
861 | + 'hostname': 'host2', |
862 | + 'locked': True, |
863 | + 'locked_by': 'user0', |
864 | + 'lock_time': '2008-07-23 12:54:15', |
865 | + 'labels': ['label3', 'label4', 'plat1'], |
866 | + 'invalid': False, |
867 | + 'synch_id': None, |
868 | + 'platform': 'plat1', |
869 | + 'id': 3}])], |
870 | out_words_ok=['host1', 'Ready', 'plat1', |
871 | 'label2', 'label3', 'True', |
872 | 'host2', 'label4'], |
873 | @@ -224,16 +224,16 @@ class host_list_unittest(cli_mock.cli_unittest): |
874 | # This is a bit fragile as the list order may change... |
875 | rpcs=[('get_hosts', {'hostname__in': ['host2', 'host1']}, |
876 | True, |
877 | - [{u'status': u'Ready', |
878 | - u'hostname': u'host2', |
879 | - u'locked': True, |
880 | - u'locked_by': 'user0', |
881 | - u'lock_time': u'2008-07-23 12:54:15', |
882 | - u'labels': [u'label3', u'label4', u'plat1'], |
883 | - u'invalid': False, |
884 | - u'synch_id': None, |
885 | - u'platform': u'plat1', |
886 | - u'id': 3}])], |
887 | + [{'status': 'Ready', |
888 | + 'hostname': 'host2', |
889 | + 'locked': True, |
890 | + 'locked_by': 'user0', |
891 | + 'lock_time': '2008-07-23 12:54:15', |
892 | + 'labels': ['label3', 'label4', 'plat1'], |
893 | + 'invalid': False, |
894 | + 'synch_id': None, |
895 | + 'platform': 'plat1', |
896 | + 'id': 3}])], |
897 | out_words_ok=['Ready', 'plat1', |
898 | 'label3', 'label4', 'True'], |
899 | out_words_no=['host1', 'False'], |
900 | @@ -256,26 +256,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
901 | '-b', 'label3', '--ignore_site_file'], |
902 | rpcs=[('get_hosts', {'labels__name__in': ['label3']}, |
903 | True, |
904 | - [{u'status': u'Ready', |
905 | - u'hostname': u'host1', |
906 | - u'locked': True, |
907 | - u'locked_by': 'user0', |
908 | - u'lock_time': u'2008-07-23 12:54:15', |
909 | - u'labels': [u'label2', u'label3', u'plat1'], |
910 | - u'invalid': False, |
911 | - u'synch_id': None, |
912 | - u'platform': u'plat1', |
913 | - u'id': 2}, |
914 | - {u'status': u'Ready', |
915 | - u'hostname': u'host2', |
916 | - u'locked': True, |
917 | - u'locked_by': 'user0', |
918 | - u'lock_time': u'2008-07-23 12:54:15', |
919 | - u'labels': [u'label3', u'label4', u'plat1'], |
920 | - u'invalid': False, |
921 | - u'synch_id': None, |
922 | - u'platform': u'plat1', |
923 | - u'id': 3}])], |
924 | + [{'status': 'Ready', |
925 | + 'hostname': 'host1', |
926 | + 'locked': True, |
927 | + 'locked_by': 'user0', |
928 | + 'lock_time': '2008-07-23 12:54:15', |
929 | + 'labels': ['label2', 'label3', 'plat1'], |
930 | + 'invalid': False, |
931 | + 'synch_id': None, |
932 | + 'platform': 'plat1', |
933 | + 'id': 2}, |
934 | + {'status': 'Ready', |
935 | + 'hostname': 'host2', |
936 | + 'locked': True, |
937 | + 'locked_by': 'user0', |
938 | + 'lock_time': '2008-07-23 12:54:15', |
939 | + 'labels': ['label3', 'label4', 'plat1'], |
940 | + 'invalid': False, |
941 | + 'synch_id': None, |
942 | + 'platform': 'plat1', |
943 | + 'id': 3}])], |
944 | out_words_ok=['host1', 'Ready', 'plat1', |
945 | 'label2', 'label3', 'True', |
946 | 'host2', 'label4'], |
947 | @@ -287,26 +287,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
948 | rpcs=[('get_hosts', {'multiple_labels': ['label2', |
949 | 'label3']}, |
950 | True, |
951 | - [{u'status': u'Ready', |
952 | - u'hostname': u'host1', |
953 | - u'locked': True, |
954 | - u'locked_by': 'user0', |
955 | - u'lock_time': u'2008-07-23 12:54:15', |
956 | - u'labels': [u'label2', u'label3', u'plat0'], |
957 | - u'invalid': False, |
958 | - u'synch_id': None, |
959 | - u'platform': u'plat0', |
960 | - u'id': 2}, |
961 | - {u'status': u'Ready', |
962 | - u'hostname': u'host3', |
963 | - u'locked': True, |
964 | - u'locked_by': 'user0', |
965 | - u'lock_time': u'2008-07-23 12:54:15', |
966 | - u'labels': [u'label3', u'label2', u'plat2'], |
967 | - u'invalid': False, |
968 | - u'synch_id': None, |
969 | - u'platform': u'plat2', |
970 | - u'id': 4}])], |
971 | + [{'status': 'Ready', |
972 | + 'hostname': 'host1', |
973 | + 'locked': True, |
974 | + 'locked_by': 'user0', |
975 | + 'lock_time': '2008-07-23 12:54:15', |
976 | + 'labels': ['label2', 'label3', 'plat0'], |
977 | + 'invalid': False, |
978 | + 'synch_id': None, |
979 | + 'platform': 'plat0', |
980 | + 'id': 2}, |
981 | + {'status': 'Ready', |
982 | + 'hostname': 'host3', |
983 | + 'locked': True, |
984 | + 'locked_by': 'user0', |
985 | + 'lock_time': '2008-07-23 12:54:15', |
986 | + 'labels': ['label3', 'label2', 'plat2'], |
987 | + 'invalid': False, |
988 | + 'synch_id': None, |
989 | + 'platform': 'plat2', |
990 | + 'id': 4}])], |
991 | out_words_ok=['host1', 'host3', 'Ready', 'plat0', |
992 | 'label2', 'label3', 'plat2'], |
993 | out_words_no=['host2', 'label4', 'False', 'plat1']) |
994 | @@ -319,17 +319,17 @@ class host_list_unittest(cli_mock.cli_unittest): |
995 | 'label3', |
996 | 'label4']}, |
997 | True, |
998 | - [{u'status': u'Ready', |
999 | - u'hostname': u'host2', |
1000 | - u'locked': True, |
1001 | - u'locked_by': 'user0', |
1002 | - u'lock_time': u'2008-07-23 12:54:15', |
1003 | - u'labels': [u'label3', u'label2', u'label4', |
1004 | - u'plat1'], |
1005 | - u'invalid': False, |
1006 | - u'synch_id': None, |
1007 | - u'platform': u'plat1', |
1008 | - u'id': 3}])], |
1009 | + [{'status': 'Ready', |
1010 | + 'hostname': 'host2', |
1011 | + 'locked': True, |
1012 | + 'locked_by': 'user0', |
1013 | + 'lock_time': '2008-07-23 12:54:15', |
1014 | + 'labels': ['label3', 'label2', 'label4', |
1015 | + 'plat1'], |
1016 | + 'invalid': False, |
1017 | + 'synch_id': None, |
1018 | + 'platform': 'plat1', |
1019 | + 'id': 3}])], |
1020 | out_words_ok=['host2', 'plat1', |
1021 | 'label2', 'label3', 'label4'], |
1022 | out_words_no=['host1', 'host3']) |
1023 | @@ -341,17 +341,17 @@ class host_list_unittest(cli_mock.cli_unittest): |
1024 | rpcs=[('get_hosts', |
1025 | {'labels__name__startswith': 'label'}, |
1026 | True, |
1027 | - [{u'status': u'Ready', |
1028 | - u'hostname': u'host2', |
1029 | - u'locked': 1, |
1030 | - u'locked_by': 'user0', |
1031 | - u'lock_time': u'2008-07-23 12:54:15', |
1032 | - u'labels': [u'label3', u'label2', u'label4', |
1033 | - u'plat1'], |
1034 | - u'invalid': 0, |
1035 | - u'synch_id': None, |
1036 | - u'platform': u'plat1', |
1037 | - u'id': 3}])], |
1038 | + [{'status': 'Ready', |
1039 | + 'hostname': 'host2', |
1040 | + 'locked': 1, |
1041 | + 'locked_by': 'user0', |
1042 | + 'lock_time': '2008-07-23 12:54:15', |
1043 | + 'labels': ['label3', 'label2', 'label4', |
1044 | + 'plat1'], |
1045 | + 'invalid': 0, |
1046 | + 'synch_id': None, |
1047 | + 'platform': 'plat1', |
1048 | + 'id': 3}])], |
1049 | out_words_ok=['host2', 'plat1', |
1050 | 'label2', 'label3', 'label4'], |
1051 | out_words_no=['host1', 'host3']) |
1052 | @@ -373,26 +373,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
1053 | rpcs=[('get_hosts', {'labels__name__in': ['label3'], |
1054 | 'hostname__in': ['host2', 'host1']}, |
1055 | True, |
1056 | - [{u'status': u'Ready', |
1057 | - u'hostname': u'host1', |
1058 | - u'locked': True, |
1059 | - u'locked_by': 'user0', |
1060 | - u'lock_time': u'2008-07-23 12:54:15', |
1061 | - u'labels': [u'label2', u'label3', u'plat1'], |
1062 | - u'invalid': False, |
1063 | - u'synch_id': None, |
1064 | - u'platform': u'plat1', |
1065 | - u'id': 2}, |
1066 | - {u'status': u'Ready', |
1067 | - u'hostname': u'host2', |
1068 | - u'locked': True, |
1069 | - u'locked_by': 'user0', |
1070 | - u'lock_time': u'2008-07-23 12:54:15', |
1071 | - u'labels': [u'label3', u'label4', u'plat1'], |
1072 | - u'invalid': False, |
1073 | - u'synch_id': None, |
1074 | - u'platform': u'plat1', |
1075 | - u'id': 3}])], |
1076 | + [{'status': 'Ready', |
1077 | + 'hostname': 'host1', |
1078 | + 'locked': True, |
1079 | + 'locked_by': 'user0', |
1080 | + 'lock_time': '2008-07-23 12:54:15', |
1081 | + 'labels': ['label2', 'label3', 'plat1'], |
1082 | + 'invalid': False, |
1083 | + 'synch_id': None, |
1084 | + 'platform': 'plat1', |
1085 | + 'id': 2}, |
1086 | + {'status': 'Ready', |
1087 | + 'hostname': 'host2', |
1088 | + 'locked': True, |
1089 | + 'locked_by': 'user0', |
1090 | + 'lock_time': '2008-07-23 12:54:15', |
1091 | + 'labels': ['label3', 'label4', 'plat1'], |
1092 | + 'invalid': False, |
1093 | + 'synch_id': None, |
1094 | + 'platform': 'plat1', |
1095 | + 'id': 3}])], |
1096 | out_words_ok=['host1', 'Ready', 'plat1', |
1097 | 'label2', 'label3', 'True', |
1098 | 'host2', 'label4'], |
1099 | @@ -414,26 +414,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
1100 | '-s', 'Ready', '--ignore_site_file'], |
1101 | rpcs=[('get_hosts', {'status__in': ['Ready']}, |
1102 | True, |
1103 | - [{u'status': u'Ready', |
1104 | - u'hostname': u'host1', |
1105 | - u'locked': True, |
1106 | - u'locked_by': 'user0', |
1107 | - u'lock_time': u'2008-07-23 12:54:15', |
1108 | - u'labels': [u'label2', u'label3', u'plat1'], |
1109 | - u'invalid': False, |
1110 | - u'synch_id': None, |
1111 | - u'platform': u'plat1', |
1112 | - u'id': 2}, |
1113 | - {u'status': u'Ready', |
1114 | - u'hostname': u'host2', |
1115 | - u'locked': True, |
1116 | - u'locked_by': 'user0', |
1117 | - u'lock_time': u'2008-07-23 12:54:15', |
1118 | - u'labels': [u'label3', u'label4', u'plat1'], |
1119 | - u'invalid': False, |
1120 | - u'synch_id': None, |
1121 | - u'platform': u'plat1', |
1122 | - u'id': 3}])], |
1123 | + [{'status': 'Ready', |
1124 | + 'hostname': 'host1', |
1125 | + 'locked': True, |
1126 | + 'locked_by': 'user0', |
1127 | + 'lock_time': '2008-07-23 12:54:15', |
1128 | + 'labels': ['label2', 'label3', 'plat1'], |
1129 | + 'invalid': False, |
1130 | + 'synch_id': None, |
1131 | + 'platform': 'plat1', |
1132 | + 'id': 2}, |
1133 | + {'status': 'Ready', |
1134 | + 'hostname': 'host2', |
1135 | + 'locked': True, |
1136 | + 'locked_by': 'user0', |
1137 | + 'lock_time': '2008-07-23 12:54:15', |
1138 | + 'labels': ['label3', 'label4', 'plat1'], |
1139 | + 'invalid': False, |
1140 | + 'synch_id': None, |
1141 | + 'platform': 'plat1', |
1142 | + 'id': 3}])], |
1143 | out_words_ok=['host1', 'Ready', 'plat1', |
1144 | 'label2', 'label3', 'True', |
1145 | 'host2', 'label4'], |
1146 | @@ -445,26 +445,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
1147 | rpcs=[('get_hosts', {'status__in': ['Ready'], |
1148 | 'hostname__in': ['host2', 'host1']}, |
1149 | True, |
1150 | - [{u'status': u'Ready', |
1151 | - u'hostname': u'host1', |
1152 | - u'locked': True, |
1153 | - u'locked_by': 'user0', |
1154 | - u'lock_time': u'2008-07-23 12:54:15', |
1155 | - u'labels': [u'label2', u'label3', u'plat1'], |
1156 | - u'invalid': False, |
1157 | - u'synch_id': None, |
1158 | - u'platform': u'plat1', |
1159 | - u'id': 2}, |
1160 | - {u'status': u'Ready', |
1161 | - u'hostname': u'host2', |
1162 | - u'locked': True, |
1163 | - u'locked_by': 'user0', |
1164 | - u'lock_time': u'2008-07-23 12:54:15', |
1165 | - u'labels': [u'label3', u'label4', u'plat1'], |
1166 | - u'invalid': False, |
1167 | - u'synch_id': None, |
1168 | - u'platform': u'plat1', |
1169 | - u'id': 3}])], |
1170 | + [{'status': 'Ready', |
1171 | + 'hostname': 'host1', |
1172 | + 'locked': True, |
1173 | + 'locked_by': 'user0', |
1174 | + 'lock_time': '2008-07-23 12:54:15', |
1175 | + 'labels': ['label2', 'label3', 'plat1'], |
1176 | + 'invalid': False, |
1177 | + 'synch_id': None, |
1178 | + 'platform': 'plat1', |
1179 | + 'id': 2}, |
1180 | + {'status': 'Ready', |
1181 | + 'hostname': 'host2', |
1182 | + 'locked': True, |
1183 | + 'locked_by': 'user0', |
1184 | + 'lock_time': '2008-07-23 12:54:15', |
1185 | + 'labels': ['label3', 'label4', 'plat1'], |
1186 | + 'invalid': False, |
1187 | + 'synch_id': None, |
1188 | + 'platform': 'plat1', |
1189 | + 'id': 3}])], |
1190 | out_words_ok=['host1', 'Ready', 'plat1', |
1191 | 'label2', 'label3', 'True', |
1192 | 'host2', 'label4'], |
1193 | @@ -500,26 +500,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
1194 | rpcs=[('get_hosts', {'locked': True, |
1195 | 'hostname__in': ['host2', 'host1']}, |
1196 | True, |
1197 | - [{u'status': u'Ready', |
1198 | - u'hostname': u'host1', |
1199 | - u'locked': True, |
1200 | - u'locked_by': 'user0', |
1201 | - u'lock_time': u'2008-07-23 12:54:15', |
1202 | - u'labels': [u'label2', u'label3', u'plat1'], |
1203 | - u'invalid': False, |
1204 | - u'synch_id': None, |
1205 | - u'platform': u'plat1', |
1206 | - u'id': 2}, |
1207 | - {u'status': u'Ready', |
1208 | - u'hostname': u'host2', |
1209 | - u'locked': True, |
1210 | - u'locked_by': 'user0', |
1211 | - u'lock_time': u'2008-07-23 12:54:15', |
1212 | - u'labels': [u'label3', u'label4', u'plat1'], |
1213 | - u'invalid': False, |
1214 | - u'synch_id': None, |
1215 | - u'platform': u'plat1', |
1216 | - u'id': 3}])], |
1217 | + [{'status': 'Ready', |
1218 | + 'hostname': 'host1', |
1219 | + 'locked': True, |
1220 | + 'locked_by': 'user0', |
1221 | + 'lock_time': '2008-07-23 12:54:15', |
1222 | + 'labels': ['label2', 'label3', 'plat1'], |
1223 | + 'invalid': False, |
1224 | + 'synch_id': None, |
1225 | + 'platform': 'plat1', |
1226 | + 'id': 2}, |
1227 | + {'status': 'Ready', |
1228 | + 'hostname': 'host2', |
1229 | + 'locked': True, |
1230 | + 'locked_by': 'user0', |
1231 | + 'lock_time': '2008-07-23 12:54:15', |
1232 | + 'labels': ['label3', 'label4', 'plat1'], |
1233 | + 'invalid': False, |
1234 | + 'synch_id': None, |
1235 | + 'platform': 'plat1', |
1236 | + 'id': 3}])], |
1237 | out_words_ok=['host1', 'Ready', 'plat1', |
1238 | 'label2', 'label3', 'True', |
1239 | 'host2', 'label4'], |
1240 | @@ -530,26 +530,26 @@ class host_list_unittest(cli_mock.cli_unittest): |
1241 | '--unlocked', '--ignore_site_file'], |
1242 | rpcs=[('get_hosts', {'locked': False}, |
1243 | True, |
1244 | - [{u'status': u'Ready', |
1245 | - u'hostname': u'host1', |
1246 | - u'locked': False, |
1247 | - u'locked_by': 'user0', |
1248 | - u'lock_time': u'2008-07-23 12:54:15', |
1249 | - u'labels': [u'label2', u'label3', u'plat1'], |
1250 | - u'invalid': False, |
1251 | - u'synch_id': None, |
1252 | - u'platform': u'plat1', |
1253 | - u'id': 2}, |
1254 | - {u'status': u'Ready', |
1255 | - u'hostname': u'host2', |
1256 | - u'locked': False, |
1257 | - u'locked_by': 'user0', |
1258 | - u'lock_time': u'2008-07-23 12:54:15', |
1259 | - u'labels': [u'label3', u'label4', u'plat1'], |
1260 | - u'invalid': False, |
1261 | - u'synch_id': None, |
1262 | - u'platform': u'plat1', |
1263 | - u'id': 3}])], |
1264 | + [{'status': 'Ready', |
1265 | + 'hostname': 'host1', |
1266 | + 'locked': False, |
1267 | + 'locked_by': 'user0', |
1268 | + 'lock_time': '2008-07-23 12:54:15', |
1269 | + 'labels': ['label2', 'label3', 'plat1'], |
1270 | + 'invalid': False, |
1271 | + 'synch_id': None, |
1272 | + 'platform': 'plat1', |
1273 | + 'id': 2}, |
1274 | + {'status': 'Ready', |
1275 | + 'hostname': 'host2', |
1276 | + 'locked': False, |
1277 | + 'locked_by': 'user0', |
1278 | + 'lock_time': '2008-07-23 12:54:15', |
1279 | + 'labels': ['label3', 'label4', 'plat1'], |
1280 | + 'invalid': False, |
1281 | + 'synch_id': None, |
1282 | + 'platform': 'plat1', |
1283 | + 'id': 3}])], |
1284 | out_words_ok=['host1', 'Ready', 'plat1', |
1285 | 'label2', 'label3', 'False', |
1286 | 'host2', 'label4'], |
1287 | @@ -564,68 +564,68 @@ class host_stat_unittest(cli_mock.cli_unittest): |
1288 | '--ignore_site_file'], |
1289 | rpcs=[('get_hosts', {'hostname': 'host1'}, |
1290 | True, |
1291 | - [{u'status': u'Ready', |
1292 | - u'hostname': u'host1', |
1293 | - u'locked': True, |
1294 | - u'lock_time': u'2008-07-23 12:54:15', |
1295 | - u'locked_by': 'user0', |
1296 | - u'protection': 'No protection', |
1297 | - u'labels': [u'label3', u'label4', u'plat1'], |
1298 | - u'invalid': False, |
1299 | - u'synch_id': None, |
1300 | - u'platform': u'plat1', |
1301 | - u'id': 3}]), |
1302 | + [{'status': 'Ready', |
1303 | + 'hostname': 'host1', |
1304 | + 'locked': True, |
1305 | + 'lock_time': '2008-07-23 12:54:15', |
1306 | + 'locked_by': 'user0', |
1307 | + 'protection': 'No protection', |
1308 | + 'labels': ['label3', 'label4', 'plat1'], |
1309 | + 'invalid': False, |
1310 | + 'synch_id': None, |
1311 | + 'platform': 'plat1', |
1312 | + 'id': 3}]), |
1313 | ('get_hosts', {'hostname': 'host0'}, |
1314 | True, |
1315 | - [{u'status': u'Ready', |
1316 | - u'hostname': u'host0', |
1317 | - u'locked': False, |
1318 | - u'locked_by': 'user0', |
1319 | - u'lock_time': u'2008-07-23 12:54:15', |
1320 | - u'protection': u'No protection', |
1321 | - u'labels': [u'label0', u'plat0'], |
1322 | - u'invalid': False, |
1323 | - u'synch_id': None, |
1324 | - u'platform': u'plat0', |
1325 | - u'id': 2}]), |
1326 | + [{'status': 'Ready', |
1327 | + 'hostname': 'host0', |
1328 | + 'locked': False, |
1329 | + 'locked_by': 'user0', |
1330 | + 'lock_time': '2008-07-23 12:54:15', |
1331 | + 'protection': 'No protection', |
1332 | + 'labels': ['label0', 'plat0'], |
1333 | + 'invalid': False, |
1334 | + 'synch_id': None, |
1335 | + 'platform': 'plat0', |
1336 | + 'id': 2}]), |
1337 | ('get_acl_groups', {'hosts__hostname': 'host1'}, |
1338 | True, |
1339 | - [{u'description': u'', |
1340 | - u'hosts': [u'host0', u'host1'], |
1341 | - u'id': 1, |
1342 | - u'name': u'Everyone', |
1343 | - u'users': [u'user2', u'debug_user', u'user0']}]), |
1344 | + [{'description': '', |
1345 | + 'hosts': ['host0', 'host1'], |
1346 | + 'id': 1, |
1347 | + 'name': 'Everyone', |
1348 | + 'users': ['user2', 'debug_user', 'user0']}]), |
1349 | ('get_labels', {'host__hostname': 'host1'}, |
1350 | True, |
1351 | - [{u'id': 2, |
1352 | - u'platform': 1, |
1353 | - u'name': u'jme', |
1354 | - u'invalid': False, |
1355 | - u'kernel_config': u''}]), |
1356 | + [{'id': 2, |
1357 | + 'platform': 1, |
1358 | + 'name': 'jme', |
1359 | + 'invalid': False, |
1360 | + 'kernel_config': ''}]), |
1361 | ('get_acl_groups', {'hosts__hostname': 'host0'}, |
1362 | True, |
1363 | - [{u'description': u'', |
1364 | - u'hosts': [u'host0', u'host1'], |
1365 | - u'id': 1, |
1366 | - u'name': u'Everyone', |
1367 | - u'users': [u'user0', u'debug_user']}, |
1368 | - {u'description': u'myacl0', |
1369 | - u'hosts': [u'host0'], |
1370 | - u'id': 2, |
1371 | - u'name': u'acl0', |
1372 | - u'users': [u'user0']}]), |
1373 | + [{'description': '', |
1374 | + 'hosts': ['host0', 'host1'], |
1375 | + 'id': 1, |
1376 | + 'name': 'Everyone', |
1377 | + 'users': ['user0', 'debug_user']}, |
1378 | + {'description': 'myacl0', |
1379 | + 'hosts': ['host0'], |
1380 | + 'id': 2, |
1381 | + 'name': 'acl0', |
1382 | + 'users': ['user0']}]), |
1383 | ('get_labels', {'host__hostname': 'host0'}, |
1384 | True, |
1385 | - [{u'id': 4, |
1386 | - u'platform': 0, |
1387 | - u'name': u'label0', |
1388 | - u'invalid': False, |
1389 | - u'kernel_config': u''}, |
1390 | - {u'id': 5, |
1391 | - u'platform': 1, |
1392 | - u'name': u'plat0', |
1393 | - u'invalid': False, |
1394 | - u'kernel_config': u''}])], |
1395 | + [{'id': 4, |
1396 | + 'platform': 0, |
1397 | + 'name': 'label0', |
1398 | + 'invalid': False, |
1399 | + 'kernel_config': ''}, |
1400 | + {'id': 5, |
1401 | + 'platform': 1, |
1402 | + 'name': 'plat0', |
1403 | + 'invalid': False, |
1404 | + 'kernel_config': ''}])], |
1405 | out_words_ok=['host0', 'host1', 'plat0', 'plat1', |
1406 | 'Everyone', 'acl0', 'label0']) |
1407 | |
1408 | @@ -637,41 +637,41 @@ class host_stat_unittest(cli_mock.cli_unittest): |
1409 | []), |
1410 | ('get_hosts', {'hostname': 'host0'}, |
1411 | True, |
1412 | - [{u'status': u'Ready', |
1413 | - u'hostname': u'host0', |
1414 | - u'locked': False, |
1415 | - u'locked_by': 'user0', |
1416 | - u'lock_time': u'2008-07-23 12:54:15', |
1417 | - u'protection': u'No protection', |
1418 | - u'labels': [u'label0', u'plat0'], |
1419 | - u'invalid': False, |
1420 | - u'synch_id': None, |
1421 | - u'platform': u'plat0', |
1422 | - u'id': 2}]), |
1423 | + [{'status': 'Ready', |
1424 | + 'hostname': 'host0', |
1425 | + 'locked': False, |
1426 | + 'locked_by': 'user0', |
1427 | + 'lock_time': '2008-07-23 12:54:15', |
1428 | + 'protection': 'No protection', |
1429 | + 'labels': ['label0', 'plat0'], |
1430 | + 'invalid': False, |
1431 | + 'synch_id': None, |
1432 | + 'platform': 'plat0', |
1433 | + 'id': 2}]), |
1434 | ('get_acl_groups', {'hosts__hostname': 'host0'}, |
1435 | True, |
1436 | - [{u'description': u'', |
1437 | - u'hosts': [u'host0', u'host1'], |
1438 | - u'id': 1, |
1439 | - u'name': u'Everyone', |
1440 | - u'users': [u'user0', u'debug_user']}, |
1441 | - {u'description': u'myacl0', |
1442 | - u'hosts': [u'host0'], |
1443 | - u'id': 2, |
1444 | - u'name': u'acl0', |
1445 | - u'users': [u'user0']}]), |
1446 | + [{'description': '', |
1447 | + 'hosts': ['host0', 'host1'], |
1448 | + 'id': 1, |
1449 | + 'name': 'Everyone', |
1450 | + 'users': ['user0', 'debug_user']}, |
1451 | + {'description': 'myacl0', |
1452 | + 'hosts': ['host0'], |
1453 | + 'id': 2, |
1454 | + 'name': 'acl0', |
1455 | + 'users': ['user0']}]), |
1456 | ('get_labels', {'host__hostname': 'host0'}, |
1457 | True, |
1458 | - [{u'id': 4, |
1459 | - u'platform': 0, |
1460 | - u'name': u'label0', |
1461 | - u'invalid': False, |
1462 | - u'kernel_config': u''}, |
1463 | - {u'id': 5, |
1464 | - u'platform': 1, |
1465 | - u'name': u'plat0', |
1466 | - u'invalid': False, |
1467 | - u'kernel_config': u''}])], |
1468 | + [{'id': 4, |
1469 | + 'platform': 0, |
1470 | + 'name': 'label0', |
1471 | + 'invalid': False, |
1472 | + 'kernel_config': ''}, |
1473 | + {'id': 5, |
1474 | + 'platform': 1, |
1475 | + 'name': 'plat0', |
1476 | + 'invalid': False, |
1477 | + 'kernel_config': ''}])], |
1478 | out_words_ok=['host0', 'plat0', |
1479 | 'Everyone', 'acl0', 'label0'], |
1480 | out_words_no=['host1'], |
1481 | @@ -686,41 +686,41 @@ class host_stat_unittest(cli_mock.cli_unittest): |
1482 | []), |
1483 | ('get_hosts', {'hostname': 'host0'}, |
1484 | True, |
1485 | - [{u'status': u'Ready', |
1486 | - u'hostname': u'host0', |
1487 | - u'locked': False, |
1488 | - u'locked_by': 'user0', |
1489 | - u'lock_time': u'2008-07-23 12:54:15', |
1490 | - u'protection': u'No protection', |
1491 | - u'labels': [u'label0', u'plat0'], |
1492 | - u'invalid': False, |
1493 | - u'synch_id': None, |
1494 | - u'platform': u'plat0', |
1495 | - u'id': 2}]), |
1496 | + [{'status': 'Ready', |
1497 | + 'hostname': 'host0', |
1498 | + 'locked': False, |
1499 | + 'locked_by': 'user0', |
1500 | + 'lock_time': '2008-07-23 12:54:15', |
1501 | + 'protection': 'No protection', |
1502 | + 'labels': ['label0', 'plat0'], |
1503 | + 'invalid': False, |
1504 | + 'synch_id': None, |
1505 | + 'platform': 'plat0', |
1506 | + 'id': 2}]), |
1507 | ('get_acl_groups', {'hosts__hostname': 'host0'}, |
1508 | True, |
1509 | - [{u'description': u'', |
1510 | - u'hosts': [u'host0', u'host1'], |
1511 | - u'id': 1, |
1512 | - u'name': u'Everyone', |
1513 | - u'users': [u'user0', u'debug_user']}, |
1514 | - {u'description': u'myacl0', |
1515 | - u'hosts': [u'host0'], |
1516 | - u'id': 2, |
1517 | - u'name': u'acl0', |
1518 | - u'users': [u'user0']}]), |
1519 | + [{'description': '', |
1520 | + 'hosts': ['host0', 'host1'], |
1521 | + 'id': 1, |
1522 | + 'name': 'Everyone', |
1523 | + 'users': ['user0', 'debug_user']}, |
1524 | + {'description': 'myacl0', |
1525 | + 'hosts': ['host0'], |
1526 | + 'id': 2, |
1527 | + 'name': 'acl0', |
1528 | + 'users': ['user0']}]), |
1529 | ('get_labels', {'host__hostname': 'host0'}, |
1530 | True, |
1531 | - [{u'id': 4, |
1532 | - u'platform': 0, |
1533 | - u'name': u'label0', |
1534 | - u'invalid': False, |
1535 | - u'kernel_config': u''}, |
1536 | - {u'id': 5, |
1537 | - u'platform': 1, |
1538 | - u'name': u'plat0', |
1539 | - u'invalid': False, |
1540 | - u'kernel_config': u''}])], |
1541 | + [{'id': 4, |
1542 | + 'platform': 0, |
1543 | + 'name': 'label0', |
1544 | + 'invalid': False, |
1545 | + 'kernel_config': ''}, |
1546 | + {'id': 5, |
1547 | + 'platform': 1, |
1548 | + 'name': 'plat0', |
1549 | + 'invalid': False, |
1550 | + 'kernel_config': ''}])], |
1551 | out_words_ok=['host0', 'plat0', |
1552 | 'Everyone', 'acl0', 'label0'], |
1553 | out_words_no=['host1'], |
1554 | @@ -733,66 +733,66 @@ class host_stat_unittest(cli_mock.cli_unittest): |
1555 | '--ignore_site_file'], |
1556 | rpcs=[('get_hosts', {'hostname__startswith': 'ho'}, |
1557 | True, |
1558 | - [{u'status': u'Ready', |
1559 | - u'hostname': u'host1', |
1560 | - u'locked': True, |
1561 | - u'lock_time': u'2008-07-23 12:54:15', |
1562 | - u'locked_by': 'user0', |
1563 | - u'protection': 'No protection', |
1564 | - u'labels': [u'label3', u'label4', u'plat1'], |
1565 | - u'invalid': False, |
1566 | - u'synch_id': None, |
1567 | - u'platform': u'plat1', |
1568 | - u'id': 3}, |
1569 | - {u'status': u'Ready', |
1570 | - u'hostname': u'host0', |
1571 | - u'locked': False, |
1572 | - u'locked_by': 'user0', |
1573 | - u'lock_time': u'2008-07-23 12:54:15', |
1574 | - u'protection': u'No protection', |
1575 | - u'labels': [u'label0', u'plat0'], |
1576 | - u'invalid': False, |
1577 | - u'synch_id': None, |
1578 | - u'platform': u'plat0', |
1579 | - u'id': 2}]), |
1580 | + [{'status': 'Ready', |
1581 | + 'hostname': 'host1', |
1582 | + 'locked': True, |
1583 | + 'lock_time': '2008-07-23 12:54:15', |
1584 | + 'locked_by': 'user0', |
1585 | + 'protection': 'No protection', |
1586 | + 'labels': ['label3', 'label4', 'plat1'], |
1587 | + 'invalid': False, |
1588 | + 'synch_id': None, |
1589 | + 'platform': 'plat1', |
1590 | + 'id': 3}, |
1591 | + {'status': 'Ready', |
1592 | + 'hostname': 'host0', |
1593 | + 'locked': False, |
1594 | + 'locked_by': 'user0', |
1595 | + 'lock_time': '2008-07-23 12:54:15', |
1596 | + 'protection': 'No protection', |
1597 | + 'labels': ['label0', 'plat0'], |
1598 | + 'invalid': False, |
1599 | + 'synch_id': None, |
1600 | + 'platform': 'plat0', |
1601 | + 'id': 2}]), |
1602 | ('get_acl_groups', {'hosts__hostname': 'host1'}, |
1603 | True, |
1604 | - [{u'description': u'', |
1605 | - u'hosts': [u'host0', u'host1'], |
1606 | - u'id': 1, |
1607 | - u'name': u'Everyone', |
1608 | - u'users': [u'user2', u'debug_user', u'user0']}]), |
1609 | + [{'description': '', |
1610 | + 'hosts': ['host0', 'host1'], |
1611 | + 'id': 1, |
1612 | + 'name': 'Everyone', |
1613 | + 'users': ['user2', 'debug_user', 'user0']}]), |
1614 | ('get_labels', {'host__hostname': 'host1'}, |
1615 | True, |
1616 | - [{u'id': 2, |
1617 | - u'platform': 1, |
1618 | - u'name': u'jme', |
1619 | - u'invalid': False, |
1620 | - u'kernel_config': u''}]), |
1621 | + [{'id': 2, |
1622 | + 'platform': 1, |
1623 | + 'name': 'jme', |
1624 | + 'invalid': False, |
1625 | + 'kernel_config': ''}]), |
1626 | ('get_acl_groups', {'hosts__hostname': 'host0'}, |
1627 | True, |
1628 | - [{u'description': u'', |
1629 | - u'hosts': [u'host0', u'host1'], |
1630 | - u'id': 1, |
1631 | - u'name': u'Everyone', |
1632 | - u'users': [u'user0', u'debug_user']}, |
1633 | - {u'description': u'myacl0', |
1634 | - u'hosts': [u'host0'], |
1635 | - u'id': 2, |
1636 | - u'name': u'acl0', |
1637 | - u'users': [u'user0']}]), |
1638 | + [{'description': '', |
1639 | + 'hosts': ['host0', 'host1'], |
1640 | + 'id': 1, |
1641 | + 'name': 'Everyone', |
1642 | + 'users': ['user0', 'debug_user']}, |
1643 | + {'description': 'myacl0', |
1644 | + 'hosts': ['host0'], |
1645 | + 'id': 2, |
1646 | + 'name': 'acl0', |
1647 | + 'users': ['user0']}]), |
1648 | ('get_labels', {'host__hostname': 'host0'}, |
1649 | True, |
1650 | - [{u'id': 4, |
1651 | - u'platform': 0, |
1652 | - u'name': u'label0', |
1653 | - u'invalid': False, |
1654 | - u'kernel_config': u''}, |
1655 | - {u'id': 5, |
1656 | - u'platform': 1, |
1657 | - u'name': u'plat0', |
1658 | - u'invalid': False, |
1659 | - u'kernel_config': u''}])], |
1660 | + [{'id': 4, |
1661 | + 'platform': 0, |
1662 | + 'name': 'label0', |
1663 | + 'invalid': False, |
1664 | + 'kernel_config': ''}, |
1665 | + {'id': 5, |
1666 | + 'platform': 1, |
1667 | + 'name': 'plat0', |
1668 | + 'invalid': False, |
1669 | + 'kernel_config': ''}])], |
1670 | out_words_ok=['host0', 'host1', 'plat0', 'plat1', |
1671 | 'Everyone', 'acl0', 'label0']) |
1672 | |
1673 | @@ -802,103 +802,103 @@ class host_stat_unittest(cli_mock.cli_unittest): |
1674 | '--ignore_site_file'], |
1675 | rpcs=[('get_hosts', {'hostname': 'newhost0'}, |
1676 | True, |
1677 | - [{u'status': u'Ready', |
1678 | - u'hostname': u'newhost0', |
1679 | - u'locked': False, |
1680 | - u'locked_by': 'user0', |
1681 | - u'lock_time': u'2008-07-23 12:54:15', |
1682 | - u'protection': u'No protection', |
1683 | - u'labels': [u'label0', u'plat0'], |
1684 | - u'invalid': False, |
1685 | - u'synch_id': None, |
1686 | - u'platform': u'plat0', |
1687 | - u'id': 5}]), |
1688 | + [{'status': 'Ready', |
1689 | + 'hostname': 'newhost0', |
1690 | + 'locked': False, |
1691 | + 'locked_by': 'user0', |
1692 | + 'lock_time': '2008-07-23 12:54:15', |
1693 | + 'protection': 'No protection', |
1694 | + 'labels': ['label0', 'plat0'], |
1695 | + 'invalid': False, |
1696 | + 'synch_id': None, |
1697 | + 'platform': 'plat0', |
1698 | + 'id': 5}]), |
1699 | ('get_hosts', {'hostname__startswith': 'ho'}, |
1700 | True, |
1701 | - [{u'status': u'Ready', |
1702 | - u'hostname': u'host1', |
1703 | - u'locked': True, |
1704 | - u'lock_time': u'2008-07-23 12:54:15', |
1705 | - u'locked_by': 'user0', |
1706 | - u'protection': 'No protection', |
1707 | - u'labels': [u'label3', u'label4', u'plat1'], |
1708 | - u'invalid': False, |
1709 | - u'synch_id': None, |
1710 | - u'platform': u'plat1', |
1711 | - u'id': 3}, |
1712 | - {u'status': u'Ready', |
1713 | - u'hostname': u'host0', |
1714 | - u'locked': False, |
1715 | - u'locked_by': 'user0', |
1716 | - u'protection': 'No protection', |
1717 | - u'lock_time': u'2008-07-23 12:54:15', |
1718 | - u'labels': [u'label0', u'plat0'], |
1719 | - u'invalid': False, |
1720 | - u'synch_id': None, |
1721 | - u'platform': u'plat0', |
1722 | - u'id': 2}]), |
1723 | + [{'status': 'Ready', |
1724 | + 'hostname': 'host1', |
1725 | + 'locked': True, |
1726 | + 'lock_time': '2008-07-23 12:54:15', |
1727 | + 'locked_by': 'user0', |
1728 | + 'protection': 'No protection', |
1729 | + 'labels': ['label3', 'label4', 'plat1'], |
1730 | + 'invalid': False, |
1731 | + 'synch_id': None, |
1732 | + 'platform': 'plat1', |
1733 | + 'id': 3}, |
1734 | + {'status': 'Ready', |
1735 | + 'hostname': 'host0', |
1736 | + 'locked': False, |
1737 | + 'locked_by': 'user0', |
1738 | + 'protection': 'No protection', |
1739 | + 'lock_time': '2008-07-23 12:54:15', |
1740 | + 'labels': ['label0', 'plat0'], |
1741 | + 'invalid': False, |
1742 | + 'synch_id': None, |
1743 | + 'platform': 'plat0', |
1744 | + 'id': 2}]), |
1745 | ('get_acl_groups', {'hosts__hostname': 'newhost0'}, |
1746 | True, |
1747 | - [{u'description': u'', |
1748 | - u'hosts': [u'newhost0', 'host1'], |
1749 | - u'id': 42, |
1750 | - u'name': u'my_acl', |
1751 | - u'users': [u'user0', u'debug_user']}, |
1752 | - {u'description': u'my favorite acl', |
1753 | - u'hosts': [u'newhost0'], |
1754 | - u'id': 2, |
1755 | - u'name': u'acl10', |
1756 | - u'users': [u'user0']}]), |
1757 | + [{'description': '', |
1758 | + 'hosts': ['newhost0', 'host1'], |
1759 | + 'id': 42, |
1760 | + 'name': 'my_acl', |
1761 | + 'users': ['user0', 'debug_user']}, |
1762 | + {'description': 'my favorite acl', |
1763 | + 'hosts': ['newhost0'], |
1764 | + 'id': 2, |
1765 | + 'name': 'acl10', |
1766 | + 'users': ['user0']}]), |
1767 | ('get_labels', {'host__hostname': 'newhost0'}, |
1768 | True, |
1769 | - [{u'id': 4, |
1770 | - u'platform': 0, |
1771 | - u'name': u'label0', |
1772 | - u'invalid': False, |
1773 | - u'kernel_config': u''}, |
1774 | - {u'id': 5, |
1775 | - u'platform': 1, |
1776 | - u'name': u'plat0', |
1777 | - u'invalid': False, |
1778 | - u'kernel_config': u''}]), |
1779 | + [{'id': 4, |
1780 | + 'platform': 0, |
1781 | + 'name': 'label0', |
1782 | + 'invalid': False, |
1783 | + 'kernel_config': ''}, |
1784 | + {'id': 5, |
1785 | + 'platform': 1, |
1786 | + 'name': 'plat0', |
1787 | + 'invalid': False, |
1788 | + 'kernel_config': ''}]), |
1789 | ('get_acl_groups', {'hosts__hostname': 'host1'}, |
1790 | True, |
1791 | - [{u'description': u'', |
1792 | - u'hosts': [u'host0', u'host1'], |
1793 | - u'id': 1, |
1794 | - u'name': u'Everyone', |
1795 | - u'users': [u'user2', u'debug_user', u'user0']}]), |
1796 | + [{'description': '', |
1797 | + 'hosts': ['host0', 'host1'], |
1798 | + 'id': 1, |
1799 | + 'name': 'Everyone', |
1800 | + 'users': ['user2', 'debug_user', 'user0']}]), |
1801 | ('get_labels', {'host__hostname': 'host1'}, |
1802 | True, |
1803 | - [{u'id': 2, |
1804 | - u'platform': 1, |
1805 | - u'name': u'jme', |
1806 | - u'invalid': False, |
1807 | - u'kernel_config': u''}]), |
1808 | + [{'id': 2, |
1809 | + 'platform': 1, |
1810 | + 'name': 'jme', |
1811 | + 'invalid': False, |
1812 | + 'kernel_config': ''}]), |
1813 | ('get_acl_groups', {'hosts__hostname': 'host0'}, |
1814 | True, |
1815 | - [{u'description': u'', |
1816 | - u'hosts': [u'host0', u'host1'], |
1817 | - u'id': 1, |
1818 | - u'name': u'Everyone', |
1819 | - u'users': [u'user0', u'debug_user']}, |
1820 | - {u'description': u'myacl0', |
1821 | - u'hosts': [u'host0'], |
1822 | - u'id': 2, |
1823 | - u'name': u'acl0', |
1824 | - u'users': [u'user0']}]), |
1825 | + [{'description': '', |
1826 | + 'hosts': ['host0', 'host1'], |
1827 | + 'id': 1, |
1828 | + 'name': 'Everyone', |
1829 | + 'users': ['user0', 'debug_user']}, |
1830 | + {'description': 'myacl0', |
1831 | + 'hosts': ['host0'], |
1832 | + 'id': 2, |
1833 | + 'name': 'acl0', |
1834 | + 'users': ['user0']}]), |
1835 | ('get_labels', {'host__hostname': 'host0'}, |
1836 | True, |
1837 | - [{u'id': 4, |
1838 | - u'platform': 0, |
1839 | - u'name': u'label0', |
1840 | - u'invalid': False, |
1841 | - u'kernel_config': u''}, |
1842 | - {u'id': 5, |
1843 | - u'platform': 1, |
1844 | - u'name': u'plat0', |
1845 | - u'invalid': False, |
1846 | - u'kernel_config': u''}])], |
1847 | + [{'id': 4, |
1848 | + 'platform': 0, |
1849 | + 'name': 'label0', |
1850 | + 'invalid': False, |
1851 | + 'kernel_config': ''}, |
1852 | + {'id': 5, |
1853 | + 'platform': 1, |
1854 | + 'name': 'plat0', |
1855 | + 'invalid': False, |
1856 | + 'kernel_config': ''}])], |
1857 | out_words_ok=['host0', 'host1', 'newhost0', |
1858 | 'plat0', 'plat1', |
1859 | 'Everyone', 'acl10', 'label0']) |
1860 | @@ -913,19 +913,19 @@ class host_jobs_unittest(cli_mock.cli_unittest): |
1861 | {'host__hostname': 'host0', 'query_limit': 20, |
1862 | 'sort_by': ['-job__id']}, |
1863 | True, |
1864 | - [{u'status': u'Failed', |
1865 | - u'complete': 1, |
1866 | - u'host': {u'status': u'Ready', |
1867 | - u'locked': True, |
1868 | - u'locked_by': 'user0', |
1869 | - u'hostname': u'host0', |
1870 | - u'invalid': False, |
1871 | - u'id': 3232, |
1872 | - u'synch_id': None}, |
1873 | - u'priority': 0, |
1874 | - u'meta_host': u'meta0', |
1875 | - u'job': {u'control_file': |
1876 | - (u"def step_init():\n" |
1877 | + [{'status': 'Failed', |
1878 | + 'complete': 1, |
1879 | + 'host': {'status': 'Ready', |
1880 | + 'locked': True, |
1881 | + 'locked_by': 'user0', |
1882 | + 'hostname': 'host0', |
1883 | + 'invalid': False, |
1884 | + 'id': 3232, |
1885 | + 'synch_id': None}, |
1886 | + 'priority': 0, |
1887 | + 'meta_host': 'meta0', |
1888 | + 'job': {'control_file': |
1889 | + ("def step_init():\n" |
1890 | "\tjob.next_step([step_test])\n" |
1891 | "\ttestkernel = job.kernel(" |
1892 | "'kernel-smp-2.6.xyz.x86_64.rpm')\n" |
1893 | @@ -933,41 +933,41 @@ class host_jobs_unittest(cli_mock.cli_unittest): |
1894 | "\ttestkernel.boot()\n\n" |
1895 | "def step_test():\n" |
1896 | "\tjob.run_test('kernbench')\n\n"), |
1897 | - u'name': u'kernel-smp-2.6.xyz.x86_64', |
1898 | - u'control_type': u'Client', |
1899 | - u'synchronizing': None, |
1900 | - u'priority': u'Low', |
1901 | - u'owner': u'user0', |
1902 | - u'created_on': u'2008-01-09 10:45:12', |
1903 | - u'synch_count': None, |
1904 | - u'synch_type': u'Asynchronous', |
1905 | - u'id': 216}, |
1906 | - u'active': 0, |
1907 | - u'id': 2981}, |
1908 | - {u'status': u'Aborted', |
1909 | - u'complete': 1, |
1910 | - u'host': {u'status': u'Ready', |
1911 | - u'locked': True, |
1912 | - u'locked_by': 'user0', |
1913 | - u'hostname': u'host0', |
1914 | - u'invalid': False, |
1915 | - u'id': 3232, |
1916 | - u'synch_id': None}, |
1917 | - u'priority': 0, |
1918 | - u'meta_host': None, |
1919 | - u'job': {u'control_file': |
1920 | - u"job.run_test('sleeptest')\n\n", |
1921 | - u'name': u'testjob', |
1922 | - u'control_type': u'Client', |
1923 | - u'synchronizing': 0, |
1924 | - u'priority': u'Low', |
1925 | - u'owner': u'user1', |
1926 | - u'created_on': u'2008-01-17 15:04:53', |
1927 | - u'synch_count': None, |
1928 | - u'synch_type': u'Asynchronous', |
1929 | - u'id': 289}, |
1930 | - u'active': 0, |
1931 | - u'id': 3167}])], |
1932 | + 'name': 'kernel-smp-2.6.xyz.x86_64', |
1933 | + 'control_type': 'Client', |
1934 | + 'synchronizing': None, |
1935 | + 'priority': 'Low', |
1936 | + 'owner': 'user0', |
1937 | + 'created_on': '2008-01-09 10:45:12', |
1938 | + 'synch_count': None, |
1939 | + 'synch_type': 'Asynchronous', |
1940 | + 'id': 216}, |
1941 | + 'active': 0, |
1942 | + 'id': 2981}, |
1943 | + {'status': 'Aborted', |
1944 | + 'complete': 1, |
1945 | + 'host': {'status': 'Ready', |
1946 | + 'locked': True, |
1947 | + 'locked_by': 'user0', |
1948 | + 'hostname': 'host0', |
1949 | + 'invalid': False, |
1950 | + 'id': 3232, |
1951 | + 'synch_id': None}, |
1952 | + 'priority': 0, |
1953 | + 'meta_host': None, |
1954 | + 'job': {'control_file': |
1955 | + "job.run_test('sleeptest')\n\n", |
1956 | + 'name': 'testjob', |
1957 | + 'control_type': 'Client', |
1958 | + 'synchronizing': 0, |
1959 | + 'priority': 'Low', |
1960 | + 'owner': 'user1', |
1961 | + 'created_on': '2008-01-17 15:04:53', |
1962 | + 'synch_count': None, |
1963 | + 'synch_type': 'Asynchronous', |
1964 | + 'id': 289}, |
1965 | + 'active': 0, |
1966 | + 'id': 3167}])], |
1967 | out_words_ok=['216', 'user0', 'Failed', |
1968 | 'kernel-smp-2.6.xyz.x86_64', 'Aborted', |
1969 | '289', 'user1', 'Aborted', |
1970 | @@ -978,43 +978,43 @@ class host_jobs_unittest(cli_mock.cli_unittest): |
1971 | '--ignore_site_file'], |
1972 | rpcs=[('get_hosts', {'hostname__startswith': 'ho'}, |
1973 | True, |
1974 | - [{u'status': u'Ready', |
1975 | - u'hostname': u'host1', |
1976 | - u'locked': True, |
1977 | - u'lock_time': u'2008-07-23 12:54:15', |
1978 | - u'locked_by': 'user0', |
1979 | - u'labels': [u'label3', u'label4', u'plat1'], |
1980 | - u'invalid': False, |
1981 | - u'synch_id': None, |
1982 | - u'platform': u'plat1', |
1983 | - u'id': 3}, |
1984 | - {u'status': u'Ready', |
1985 | - u'hostname': u'host0', |
1986 | - u'locked': False, |
1987 | - u'locked_by': 'user0', |
1988 | - u'lock_time': u'2008-07-23 12:54:15', |
1989 | - u'labels': [u'label0', u'plat0'], |
1990 | - u'invalid': False, |
1991 | - u'synch_id': None, |
1992 | - u'platform': u'plat0', |
1993 | - u'id': 2}]), |
1994 | + [{'status': 'Ready', |
1995 | + 'hostname': 'host1', |
1996 | + 'locked': True, |
1997 | + 'lock_time': '2008-07-23 12:54:15', |
1998 | + 'locked_by': 'user0', |
1999 | + 'labels': ['label3', 'label4', 'plat1'], |
2000 | + 'invalid': False, |
2001 | + 'synch_id': None, |
2002 | + 'platform': 'plat1', |
2003 | + 'id': 3}, |
2004 | + {'status': 'Ready', |
2005 | + 'hostname': 'host0', |
2006 | + 'locked': False, |
2007 | + 'locked_by': 'user0', |
2008 | + 'lock_time': '2008-07-23 12:54:15', |
2009 | + 'labels': ['label0', 'plat0'], |
2010 | + 'invalid': False, |
2011 | + 'synch_id': None, |
2012 | + 'platform': 'plat0', |
2013 | + 'id': 2}]), |
2014 | ('get_host_queue_entries', |
2015 | {'host__hostname': 'host1', 'query_limit': 20, |
2016 | 'sort_by': ['-job__id']}, |
2017 | True, |
2018 | - [{u'status': u'Failed', |
2019 | - u'complete': 1, |
2020 | - u'host': {u'status': u'Ready', |
2021 | - u'locked': True, |
2022 | - u'locked_by': 'user0', |
2023 | - u'hostname': u'host1', |
2024 | - u'invalid': False, |
2025 | - u'id': 3232, |
2026 | - u'synch_id': None}, |
2027 | - u'priority': 0, |
2028 | - u'meta_host': u'meta0', |
2029 | - u'job': {u'control_file': |
2030 | - (u"def step_init():\n" |
2031 | + [{'status': 'Failed', |
2032 | + 'complete': 1, |
2033 | + 'host': {'status': 'Ready', |
2034 | + 'locked': True, |
2035 | + 'locked_by': 'user0', |
2036 | + 'hostname': 'host1', |
2037 | + 'invalid': False, |
2038 | + 'id': 3232, |
2039 | + 'synch_id': None}, |
2040 | + 'priority': 0, |
2041 | + 'meta_host': 'meta0', |
2042 | + 'job': {'control_file': |
2043 | + ("def step_init():\n" |
2044 | "\tjob.next_step([step_test])\n" |
2045 | "\ttestkernel = job.kernel(" |
2046 | "'kernel-smp-2.6.xyz.x86_64.rpm')\n" |
2047 | @@ -1022,58 +1022,58 @@ class host_jobs_unittest(cli_mock.cli_unittest): |
2048 | "\ttestkernel.boot()\n\n" |
2049 | "def step_test():\n" |
2050 | "\tjob.run_test('kernbench')\n\n"), |
2051 | - u'name': u'kernel-smp-2.6.xyz.x86_64', |
2052 | - u'control_type': u'Client', |
2053 | - u'synchronizing': None, |
2054 | - u'priority': u'Low', |
2055 | - u'owner': u'user0', |
2056 | - u'created_on': u'2008-01-09 10:45:12', |
2057 | - u'synch_count': None, |
2058 | - u'synch_type': u'Asynchronous', |
2059 | - u'id': 216}, |
2060 | - u'active': 0, |
2061 | - u'id': 2981}, |
2062 | - {u'status': u'Aborted', |
2063 | - u'complete': 1, |
2064 | - u'host': {u'status': u'Ready', |
2065 | - u'locked': True, |
2066 | - u'locked_by': 'user0', |
2067 | - u'hostname': u'host1', |
2068 | - u'invalid': False, |
2069 | - u'id': 3232, |
2070 | - u'synch_id': None}, |
2071 | - u'priority': 0, |
2072 | - u'meta_host': None, |
2073 | - u'job': {u'control_file': |
2074 | - u"job.run_test('sleeptest')\n\n", |
2075 | - u'name': u'testjob', |
2076 | - u'control_type': u'Client', |
2077 | - u'synchronizing': 0, |
2078 | - u'priority': u'Low', |
2079 | - u'owner': u'user1', |
2080 | - u'created_on': u'2008-01-17 15:04:53', |
2081 | - u'synch_count': None, |
2082 | - u'synch_type': u'Asynchronous', |
2083 | - u'id': 289}, |
2084 | - u'active': 0, |
2085 | - u'id': 3167}]), |
2086 | + 'name': 'kernel-smp-2.6.xyz.x86_64', |
2087 | + 'control_type': 'Client', |
2088 | + 'synchronizing': None, |
2089 | + 'priority': 'Low', |
2090 | + 'owner': 'user0', |
2091 | + 'created_on': '2008-01-09 10:45:12', |
2092 | + 'synch_count': None, |
2093 | + 'synch_type': 'Asynchronous', |
2094 | + 'id': 216}, |
2095 | + 'active': 0, |
2096 | + 'id': 2981}, |
2097 | + {'status': 'Aborted', |
2098 | + 'complete': 1, |
2099 | + 'host': {'status': 'Ready', |
2100 | + 'locked': True, |
2101 | + 'locked_by': 'user0', |
2102 | + 'hostname': 'host1', |
2103 | + 'invalid': False, |
2104 | + 'id': 3232, |
2105 | + 'synch_id': None}, |
2106 | + 'priority': 0, |
2107 | + 'meta_host': None, |
2108 | + 'job': {'control_file': |
2109 | + "job.run_test('sleeptest')\n\n", |
2110 | + 'name': 'testjob', |
2111 | + 'control_type': 'Client', |
2112 | + 'synchronizing': 0, |
2113 | + 'priority': 'Low', |
2114 | + 'owner': 'user1', |
2115 | + 'created_on': '2008-01-17 15:04:53', |
2116 | + 'synch_count': None, |
2117 | + 'synch_type': 'Asynchronous', |
2118 | + 'id': 289}, |
2119 | + 'active': 0, |
2120 | + 'id': 3167}]), |
2121 | ('get_host_queue_entries', |
2122 | {'host__hostname': 'host0', 'query_limit': 20, |
2123 | 'sort_by': ['-job__id']}, |
2124 | True, |
2125 | - [{u'status': u'Failed', |
2126 | - u'complete': 1, |
2127 | - u'host': {u'status': u'Ready', |
2128 | - u'locked': True, |
2129 | - u'locked_by': 'user0', |
2130 | - u'hostname': u'host0', |
2131 | - u'invalid': False, |
2132 | - u'id': 3232, |
2133 | - u'synch_id': None}, |
2134 | - u'priority': 0, |
2135 | - u'meta_host': u'meta0', |
2136 | - u'job': {u'control_file': |
2137 | - (u"def step_init():\n" |
2138 | + [{'status': 'Failed', |
2139 | + 'complete': 1, |
2140 | + 'host': {'status': 'Ready', |
2141 | + 'locked': True, |
2142 | + 'locked_by': 'user0', |
2143 | + 'hostname': 'host0', |
2144 | + 'invalid': False, |
2145 | + 'id': 3232, |
2146 | + 'synch_id': None}, |
2147 | + 'priority': 0, |
2148 | + 'meta_host': 'meta0', |
2149 | + 'job': {'control_file': |
2150 | + ("def step_init():\n" |
2151 | "\tjob.next_step([step_test])\n" |
2152 | "\ttestkernel = job.kernel(" |
2153 | "'kernel-smp-2.6.xyz.x86_64.rpm')\n" |
2154 | @@ -1081,41 +1081,41 @@ class host_jobs_unittest(cli_mock.cli_unittest): |
2155 | "\ttestkernel.boot()\n\n" |
2156 | "def step_test():\n" |
2157 | "\tjob.run_test('kernbench')\n\n"), |
2158 | - u'name': u'kernel-smp-2.6.xyz.x86_64', |
2159 | - u'control_type': u'Client', |
2160 | - u'synchronizing': None, |
2161 | - u'priority': u'Low', |
2162 | - u'owner': u'user0', |
2163 | - u'created_on': u'2008-01-09 10:45:12', |
2164 | - u'synch_count': None, |
2165 | - u'synch_type': u'Asynchronous', |
2166 | - u'id': 216}, |
2167 | - u'active': 0, |
2168 | - u'id': 2981}, |
2169 | - {u'status': u'Aborted', |
2170 | - u'complete': 1, |
2171 | - u'host': {u'status': u'Ready', |
2172 | - u'locked': True, |
2173 | - u'locked_by': 'user0', |
2174 | - u'hostname': u'host0', |
2175 | - u'invalid': False, |
2176 | - u'id': 3232, |
2177 | - u'synch_id': None}, |
2178 | - u'priority': 0, |
2179 | - u'meta_host': None, |
2180 | - u'job': {u'control_file': |
2181 | - u"job.run_test('sleeptest')\n\n", |
2182 | - u'name': u'testjob', |
2183 | - u'control_type': u'Client', |
2184 | - u'synchronizing': 0, |
2185 | - u'priority': u'Low', |
2186 | - u'owner': u'user1', |
2187 | - u'created_on': u'2008-01-17 15:04:53', |
2188 | - u'synch_count': None, |
2189 | - u'synch_type': u'Asynchronous', |
2190 | - u'id': 289}, |
2191 | - u'active': 0, |
2192 | - u'id': 3167}])], |
2193 | + 'name': 'kernel-smp-2.6.xyz.x86_64', |
2194 | + 'control_type': 'Client', |
2195 | + 'synchronizing': None, |
2196 | + 'priority': 'Low', |
2197 | + 'owner': 'user0', |
2198 | + 'created_on': '2008-01-09 10:45:12', |
2199 | + 'synch_count': None, |
2200 | + 'synch_type': 'Asynchronous', |
2201 | + 'id': 216}, |
2202 | + 'active': 0, |
2203 | + 'id': 2981}, |
2204 | + {'status': 'Aborted', |
2205 | + 'complete': 1, |
2206 | + 'host': {'status': 'Ready', |
2207 | + 'locked': True, |
2208 | + 'locked_by': 'user0', |
2209 | + 'hostname': 'host0', |
2210 | + 'invalid': False, |
2211 | + 'id': 3232, |
2212 | + 'synch_id': None}, |
2213 | + 'priority': 0, |
2214 | + 'meta_host': None, |
2215 | + 'job': {'control_file': |
2216 | + "job.run_test('sleeptest')\n\n", |
2217 | + 'name': 'testjob', |
2218 | + 'control_type': 'Client', |
2219 | + 'synchronizing': 0, |
2220 | + 'priority': 'Low', |
2221 | + 'owner': 'user1', |
2222 | + 'created_on': '2008-01-17 15:04:53', |
2223 | + 'synch_count': None, |
2224 | + 'synch_type': 'Asynchronous', |
2225 | + 'id': 289}, |
2226 | + 'active': 0, |
2227 | + 'id': 3167}])], |
2228 | out_words_ok=['216', 'user0', 'Failed', |
2229 | 'kernel-smp-2.6.xyz.x86_64', 'Aborted', |
2230 | '289', 'user1', 'Aborted', |
2231 | @@ -1128,19 +1128,19 @@ class host_jobs_unittest(cli_mock.cli_unittest): |
2232 | {'host__hostname': 'host0', 'query_limit': 10, |
2233 | 'sort_by': ['-job__id']}, |
2234 | True, |
2235 | - [{u'status': u'Failed', |
2236 | - u'complete': 1, |
2237 | - u'host': {u'status': u'Ready', |
2238 | - u'locked': True, |
2239 | - u'locked_by': 'user0', |
2240 | - u'hostname': u'host0', |
2241 | - u'invalid': False, |
2242 | - u'id': 3232, |
2243 | - u'synch_id': None}, |
2244 | - u'priority': 0, |
2245 | - u'meta_host': u'meta0', |
2246 | - u'job': {u'control_file': |
2247 | - (u"def step_init():\n" |
2248 | + [{'status': 'Failed', |
2249 | + 'complete': 1, |
2250 | + 'host': {'status': 'Ready', |
2251 | + 'locked': True, |
2252 | + 'locked_by': 'user0', |
2253 | + 'hostname': 'host0', |
2254 | + 'invalid': False, |
2255 | + 'id': 3232, |
2256 | + 'synch_id': None}, |
2257 | + 'priority': 0, |
2258 | + 'meta_host': 'meta0', |
2259 | + 'job': {'control_file': |
2260 | + ("def step_init():\n" |
2261 | "\tjob.next_step([step_test])\n" |
2262 | "\ttestkernel = job.kernel(" |
2263 | "'kernel-smp-2.6.xyz.x86_64.rpm')\n" |
2264 | @@ -1148,41 +1148,41 @@ class host_jobs_unittest(cli_mock.cli_unittest): |
2265 | "\ttestkernel.boot()\n\n" |
2266 | "def step_test():\n" |
2267 | "\tjob.run_test('kernbench')\n\n"), |
2268 | - u'name': u'kernel-smp-2.6.xyz.x86_64', |
2269 | - u'control_type': u'Client', |
2270 | - u'synchronizing': None, |
2271 | - u'priority': u'Low', |
2272 | - u'owner': u'user0', |
2273 | - u'created_on': u'2008-01-09 10:45:12', |
2274 | - u'synch_count': None, |
2275 | - u'synch_type': u'Asynchronous', |
2276 | - u'id': 216}, |
2277 | - u'active': 0, |
2278 | - u'id': 2981}, |
2279 | - {u'status': u'Aborted', |
2280 | - u'complete': 1, |
2281 | - u'host': {u'status': u'Ready', |
2282 | - u'locked': True, |
2283 | - u'locked_by': 'user0', |
2284 | - u'hostname': u'host0', |
2285 | - u'invalid': False, |
2286 | - u'id': 3232, |
2287 | - u'synch_id': None}, |
2288 | - u'priority': 0, |
2289 | - u'meta_host': None, |
2290 | - u'job': {u'control_file': |
2291 | - u"job.run_test('sleeptest')\n\n", |
2292 | - u'name': u'testjob', |
2293 | - u'control_type': u'Client', |
2294 | - u'synchronizing': 0, |
2295 | - u'priority': u'Low', |
2296 | - u'owner': u'user1', |
2297 | - u'created_on': u'2008-01-17 15:04:53', |
2298 | - u'synch_count': None, |
2299 | - u'synch_type': u'Asynchronous', |
2300 | - u'id': 289}, |
2301 | - u'active': 0, |
2302 | - u'id': 3167}])], |
2303 | + 'name': 'kernel-smp-2.6.xyz.x86_64', |
2304 | + 'control_type': 'Client', |
2305 | + 'synchronizing': None, |
2306 | + 'priority': 'Low', |
2307 | + 'owner': 'user0', |
2308 | + 'created_on': '2008-01-09 10:45:12', |
2309 | + 'synch_count': None, |
2310 | + 'synch_type': 'Asynchronous', |
2311 | + 'id': 216}, |
2312 | + 'active': 0, |
2313 | + 'id': 2981}, |
2314 | + {'status': 'Aborted', |
2315 | + 'complete': 1, |
2316 | + 'host': {'status': 'Ready', |
2317 | + 'locked': True, |
2318 | + 'locked_by': 'user0', |
2319 | + 'hostname': 'host0', |
2320 | + 'invalid': False, |
2321 | + 'id': 3232, |
2322 | + 'synch_id': None}, |
2323 | + 'priority': 0, |
2324 | + 'meta_host': None, |
2325 | + 'job': {'control_file': |
2326 | + "job.run_test('sleeptest')\n\n", |
2327 | + 'name': 'testjob', |
2328 | + 'control_type': 'Client', |
2329 | + 'synchronizing': 0, |
2330 | + 'priority': 'Low', |
2331 | + 'owner': 'user1', |
2332 | + 'created_on': '2008-01-17 15:04:53', |
2333 | + 'synch_count': None, |
2334 | + 'synch_type': 'Asynchronous', |
2335 | + 'id': 289}, |
2336 | + 'active': 0, |
2337 | + 'id': 3167}])], |
2338 | out_words_ok=['216', 'user0', 'Failed', |
2339 | 'kernel-smp-2.6.xyz.x86_64', 'Aborted', |
2340 | '289', 'user1', 'Aborted', |
2341 | @@ -1260,11 +1260,11 @@ class host_create_unittest(cli_mock.cli_unittest): |
2342 | '--ignore_site_file'], |
2343 | rpcs=[('get_labels', {'name': 'label0'}, |
2344 | True, |
2345 | - [{u'id': 4, |
2346 | - u'platform': 0, |
2347 | - u'name': u'label0', |
2348 | - u'invalid': False, |
2349 | - u'kernel_config': u''}]), |
2350 | + [{'id': 4, |
2351 | + 'platform': 0, |
2352 | + 'name': 'label0', |
2353 | + 'invalid': False, |
2354 | + 'kernel_config': ''}]), |
2355 | ('get_acl_groups', {'name': 'acl0'}, |
2356 | True, []), |
2357 | ('add_acl_group', {'name': 'acl0'}, |
2358 | @@ -1294,11 +1294,11 @@ class host_create_unittest(cli_mock.cli_unittest): |
2359 | '--ignore_site_file'], |
2360 | rpcs=[('get_labels', {'name': 'label0'}, |
2361 | True, |
2362 | - [{u'id': 4, |
2363 | - u'platform': 0, |
2364 | - u'name': u'label0', |
2365 | - u'invalid': False, |
2366 | - u'kernel_config': u''}]), |
2367 | + [{'id': 4, |
2368 | + 'platform': 0, |
2369 | + 'name': 'label0', |
2370 | + 'invalid': False, |
2371 | + 'kernel_config': ''}]), |
2372 | ('get_acl_groups', {'name': 'acl0'}, |
2373 | True, []), |
2374 | ('add_acl_group', {'name': 'acl0'}, |
2375 | @@ -1333,25 +1333,25 @@ class host_create_unittest(cli_mock.cli_unittest): |
2376 | '--ignore_site_file'], |
2377 | rpcs=[('get_labels', {'name': 'label0'}, |
2378 | True, |
2379 | - [{u'id': 4, |
2380 | - u'platform': 0, |
2381 | - u'name': u'label0', |
2382 | - u'invalid': False, |
2383 | - u'kernel_config': u''}]), |
2384 | + [{'id': 4, |
2385 | + 'platform': 0, |
2386 | + 'name': 'label0', |
2387 | + 'invalid': False, |
2388 | + 'kernel_config': ''}]), |
2389 | ('get_labels', {'name': 'label,1'}, |
2390 | True, |
2391 | - [{u'id': 4, |
2392 | - u'platform': 0, |
2393 | - u'name': u'label,1', |
2394 | - u'invalid': False, |
2395 | - u'kernel_config': u''}]), |
2396 | + [{'id': 4, |
2397 | + 'platform': 0, |
2398 | + 'name': 'label,1', |
2399 | + 'invalid': False, |
2400 | + 'kernel_config': ''}]), |
2401 | ('get_labels', {'name': 'label,2'}, |
2402 | True, |
2403 | - [{u'id': 4, |
2404 | - u'platform': 0, |
2405 | - u'name': u'label,2', |
2406 | - u'invalid': False, |
2407 | - u'kernel_config': u''}]), |
2408 | + [{'id': 4, |
2409 | + 'platform': 0, |
2410 | + 'name': 'label,2', |
2411 | + 'invalid': False, |
2412 | + 'kernel_config': ''}]), |
2413 | ('get_acl_groups', {'name': 'acl0'}, |
2414 | True, []), |
2415 | ('add_acl_group', {'name': 'acl0'}, |
2416 | diff --git a/cli/job.py b/cli/job.py |
2417 | index b69d4e0..b9c76ba 100644 |
2418 | --- a/cli/job.py |
2419 | +++ b/cli/job.py |
2420 | @@ -37,7 +37,7 @@ class job(topic_common.atest): |
2421 | for result in results: |
2422 | total = sum(result['status_counts'].values()) |
2423 | status = ['%s=%s(%.1f%%)' % (key, val, 100.0 * float(val) / total) |
2424 | - for key, val in result['status_counts'].iteritems()] |
2425 | + for key, val in result['status_counts'].items()] |
2426 | status.sort() |
2427 | result['status_counts'] = ', '.join(status) |
2428 | |
2429 | @@ -194,12 +194,12 @@ class job_stat(job_list_stat): |
2430 | |
2431 | for job in summary: |
2432 | job_id = job['id'] |
2433 | - if hosts_status.has_key(job_id): |
2434 | + if job_id in hosts_status: |
2435 | this_job = hosts_status[job_id] |
2436 | job['hosts'] = ' '.join(' '.join(host) for host in |
2437 | - this_job.itervalues()) |
2438 | + this_job.values()) |
2439 | host_per_status = ['%s="%s"' % (status, ' '.join(host)) |
2440 | - for status, host in this_job.iteritems()] |
2441 | + for status, host in this_job.items()] |
2442 | job['hosts_status'] = ', '.join(host_per_status) |
2443 | if self.status_list: |
2444 | statuses = set(s.lower() for s in self.status_list) |
2445 | @@ -593,7 +593,7 @@ class job_create(job_create_or_clone): |
2446 | if uploading_kernel: |
2447 | default_timeout = socket.getdefaulttimeout() |
2448 | socket.setdefaulttimeout(topic_common.UPLOAD_SOCKET_TIMEOUT) |
2449 | - print 'Uploading Kernel: this may take a while...', |
2450 | + print('Uploading Kernel: this may take a while...', end=' ') |
2451 | sys.stdout.flush() |
2452 | try: |
2453 | cf_info = self.execute_rpc(op='generate_control_file', |
2454 | @@ -604,7 +604,7 @@ class job_create(job_create_or_clone): |
2455 | socket.setdefaulttimeout(default_timeout) |
2456 | |
2457 | if uploading_kernel: |
2458 | - print 'Done' |
2459 | + print('Done') |
2460 | self.data['control_file'] = cf_info['control_file'] |
2461 | if 'synch_count' not in self.data: |
2462 | self.data['synch_count'] = cf_info['synch_count'] |
2463 | @@ -678,16 +678,16 @@ class job_clone(job_create_or_clone): |
2464 | # Also remove parameterized_job field, as the feature still is |
2465 | # incomplete, this tool does not attempt to support it for now, |
2466 | # it uses a different API function and it breaks create_job() |
2467 | - if clone_info['job'].has_key('parameterized_job'): |
2468 | + if 'parameterized_job' in clone_info['job']: |
2469 | del clone_info['job']['parameterized_job'] |
2470 | |
2471 | # Keyword args cannot be unicode strings |
2472 | self.data.update((str(key), val) |
2473 | - for key, val in clone_info['job'].iteritems()) |
2474 | + for key, val in clone_info['job'].items()) |
2475 | |
2476 | if self.reuse_hosts: |
2477 | # Convert host list from clone info that can be used for job_create |
2478 | - for label, qty in clone_info['meta_host_counts'].iteritems(): |
2479 | + for label, qty in clone_info['meta_host_counts'].items(): |
2480 | self.data['meta_hosts'].extend([label] * qty) |
2481 | |
2482 | self.data['hosts'].extend(host['hostname'] |
2483 | @@ -711,7 +711,7 @@ class job_abort(job, action_common.atest_delete): |
2484 | def execute(self): |
2485 | data = {'job__id__in': self.jobids} |
2486 | self.execute_rpc(op='abort_host_queue_entries', **data) |
2487 | - print 'Aborting jobs: %s' % ', '.join(self.jobids) |
2488 | + print('Aborting jobs: %s' % ', '.join(self.jobids)) |
2489 | |
2490 | # The unittests will hide this method, well, for unittesting |
2491 | # pylint: disable=E0202 |
2492 | diff --git a/cli/job_unittest.py b/cli/job_unittest.py |
2493 | index 4c3277c..483e532 100755 |
2494 | --- a/cli/job_unittest.py |
2495 | +++ b/cli/job_unittest.py |
2496 | @@ -1,4 +1,4 @@ |
2497 | -#!/usr/bin/python2 -u |
2498 | +#!/usr/bin/python3 -u |
2499 | # |
2500 | # Copyright 2008 Google Inc. All Rights Reserved. |
2501 | |
2502 | @@ -14,7 +14,7 @@ import os |
2503 | try: |
2504 | import autotest.common as common |
2505 | except ImportError: |
2506 | - import common |
2507 | + from . import common |
2508 | from autotest.cli import cli_mock |
2509 | # pylint: disable=E0611 |
2510 | from autotest.cli import job |
2511 | @@ -29,85 +29,85 @@ class job_unittest(cli_mock.cli_unittest): |
2512 | super(job_unittest, self).setUp() |
2513 | self.values = copy.deepcopy(self.values_template) |
2514 | |
2515 | - results = [{u'status_counts': {u'Aborted': 1}, |
2516 | - u'control_file': |
2517 | - u"job.run_test('sleeptest')\n", |
2518 | - u'name': u'test_job0', |
2519 | - u'control_type': u'Server', |
2520 | - u'priority': |
2521 | - u'Medium', |
2522 | - u'owner': u'user0', |
2523 | - u'created_on': |
2524 | - u'2008-07-08 17:45:44', |
2525 | - u'synch_count': 2, |
2526 | - u'id': 180}, |
2527 | - {u'status_counts': {u'Queued': 1}, |
2528 | - u'control_file': |
2529 | - u"job.run_test('sleeptest')\n", |
2530 | - u'name': u'test_job1', |
2531 | - u'control_type': u'Client', |
2532 | - u'priority': |
2533 | - u'High', |
2534 | - u'owner': u'user0', |
2535 | - u'created_on': |
2536 | - u'2008-07-08 12:17:47', |
2537 | - u'synch_count': 1, |
2538 | - u'id': 338}] |
2539 | - |
2540 | - values_template = [{u'id': 180, # Valid job |
2541 | - u'priority': u'Low', |
2542 | - u'name': u'test_job0', |
2543 | - u'owner': u'Cringer', |
2544 | - u'invalid': False, |
2545 | - u'created_on': u'2008-07-02 13:02:40', |
2546 | - u'control_type': u'Server', |
2547 | - u'status_counts': {u'Queued': 1}, |
2548 | - u'synch_count': 2}, |
2549 | - {u'id': 338, # Valid job |
2550 | - u'priority': 'High', |
2551 | - u'name': u'test_job1', |
2552 | - u'owner': u'Fisto', |
2553 | - u'invalid': False, |
2554 | - u'created_on': u'2008-07-06 14:05:33', |
2555 | - u'control_type': u'Client', |
2556 | - u'status_counts': {u'Queued': 1}, |
2557 | - u'synch_count': 1}, |
2558 | - {u'id': 339, # Valid job |
2559 | - u'priority': 'Medium', |
2560 | - u'name': u'test_job2', |
2561 | - u'owner': u'Roboto', |
2562 | - u'invalid': False, |
2563 | - u'created_on': u'2008-07-07 15:33:18', |
2564 | - u'control_type': u'Server', |
2565 | - u'status_counts': {u'Queued': 1}, |
2566 | - u'synch_count': 1}, |
2567 | - {u'id': 340, # Invalid job priority |
2568 | - u'priority': u'Uber', |
2569 | - u'name': u'test_job3', |
2570 | - u'owner': u'Panthor', |
2571 | - u'invalid': True, |
2572 | - u'created_on': u'2008-07-04 00:00:01', |
2573 | - u'control_type': u'Server', |
2574 | - u'status_counts': {u'Queued': 1}, |
2575 | - u'synch_count': 2}, |
2576 | - {u'id': 350, # Invalid job created_on |
2577 | - u'priority': 'Medium', |
2578 | - u'name': u'test_job4', |
2579 | - u'owner': u'Icer', |
2580 | - u'invalid': True, |
2581 | - u'created_on': u'Today', |
2582 | - u'control_type': u'Client', |
2583 | - u'status_counts': {u'Queued': 1}, |
2584 | - u'synch_count': 1}, |
2585 | - {u'id': 420, # Invalid job control_type |
2586 | - u'priority': 'Urgent', |
2587 | - u'name': u'test_job5', |
2588 | - u'owner': u'Spikor', |
2589 | - u'invalid': True, |
2590 | - u'created_on': u'2012-08-08 18:54:37', |
2591 | - u'control_type': u'Child', |
2592 | - u'status_counts': {u'Queued': 1}, |
2593 | - u'synch_count': 2}] |
2594 | + results = [{'status_counts': {'Aborted': 1}, |
2595 | + 'control_file': |
2596 | + "job.run_test('sleeptest')\n", |
2597 | + 'name': 'test_job0', |
2598 | + 'control_type': 'Server', |
2599 | + 'priority': |
2600 | + 'Medium', |
2601 | + 'owner': 'user0', |
2602 | + 'created_on': |
2603 | + '2008-07-08 17:45:44', |
2604 | + 'synch_count': 2, |
2605 | + 'id': 180}, |
2606 | + {'status_counts': {'Queued': 1}, |
2607 | + 'control_file': |
2608 | + "job.run_test('sleeptest')\n", |
2609 | + 'name': 'test_job1', |
2610 | + 'control_type': 'Client', |
2611 | + 'priority': |
2612 | + 'High', |
2613 | + 'owner': 'user0', |
2614 | + 'created_on': |
2615 | + '2008-07-08 12:17:47', |
2616 | + 'synch_count': 1, |
2617 | + 'id': 338}] |
2618 | + |
2619 | + values_template = [{'id': 180, # Valid job |
2620 | + 'priority': 'Low', |
2621 | + 'name': 'test_job0', |
2622 | + 'owner': 'Cringer', |
2623 | + 'invalid': False, |
2624 | + 'created_on': '2008-07-02 13:02:40', |
2625 | + 'control_type': 'Server', |
2626 | + 'status_counts': {'Queued': 1}, |
2627 | + 'synch_count': 2}, |
2628 | + {'id': 338, # Valid job |
2629 | + 'priority': 'High', |
2630 | + 'name': 'test_job1', |
2631 | + 'owner': 'Fisto', |
2632 | + 'invalid': False, |
2633 | + 'created_on': '2008-07-06 14:05:33', |
2634 | + 'control_type': 'Client', |
2635 | + 'status_counts': {'Queued': 1}, |
2636 | + 'synch_count': 1}, |
2637 | + {'id': 339, # Valid job |
2638 | + 'priority': 'Medium', |
2639 | + 'name': 'test_job2', |
2640 | + 'owner': 'Roboto', |
2641 | + 'invalid': False, |
2642 | + 'created_on': '2008-07-07 15:33:18', |
2643 | + 'control_type': 'Server', |
2644 | + 'status_counts': {'Queued': 1}, |
2645 | + 'synch_count': 1}, |
2646 | + {'id': 340, # Invalid job priority |
2647 | + 'priority': 'Uber', |
2648 | + 'name': 'test_job3', |
2649 | + 'owner': 'Panthor', |
2650 | + 'invalid': True, |
2651 | + 'created_on': '2008-07-04 00:00:01', |
2652 | + 'control_type': 'Server', |
2653 | + 'status_counts': {'Queued': 1}, |
2654 | + 'synch_count': 2}, |
2655 | + {'id': 350, # Invalid job created_on |
2656 | + 'priority': 'Medium', |
2657 | + 'name': 'test_job4', |
2658 | + 'owner': 'Icer', |
2659 | + 'invalid': True, |
2660 | + 'created_on': 'Today', |
2661 | + 'control_type': 'Client', |
2662 | + 'status_counts': {'Queued': 1}, |
2663 | + 'synch_count': 1}, |
2664 | + {'id': 420, # Invalid job control_type |
2665 | + 'priority': 'Urgent', |
2666 | + 'name': 'test_job5', |
2667 | + 'owner': 'Spikor', |
2668 | + 'invalid': True, |
2669 | + 'created_on': '2012-08-08 18:54:37', |
2670 | + 'control_type': 'Child', |
2671 | + 'status_counts': {'Queued': 1}, |
2672 | + 'synch_count': 2}] |
2673 | |
2674 | |
2675 | class job_list_unittest(job_unittest): |
2676 | @@ -148,17 +148,17 @@ class job_list_unittest(job_unittest): |
2677 | rpcs=[('get_jobs_summary', {'id__in': ['5964'], |
2678 | 'running': None}, |
2679 | True, |
2680 | - [{u'status_counts': {u'Completed': 1}, |
2681 | - u'control_file': u'kernel = \'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\'\ndef step_init():\n job.next_step([step_test])\n testkernel = job.kernel(\'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\')\n \n testkernel.install()\n testkernel.boot(args=\'console_always_print=1\')\n\ndef step_test():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "Autotest Team"\n NAME = "Sleeptest"\n TIME = "SHORT"\n TEST_CATEGORY = "Functional"\n TEST_CLASS = "General"\n TEST_TYPE = "client"\n \n DOC = """\n This test simply sleeps for 1 second by default. It\'s a good way to test\n profilers and double check that autotest is working.\n The seconds argument can also be modified to make the machine sleep for as\n long as needed.\n """\n \n job.run_test(\'sleeptest\', seconds = 1)', |
2682 | - u'name': u'mytest', |
2683 | - u'control_type': u'Client', |
2684 | - u'run_verify': 1, |
2685 | - u'priority': u'Medium', |
2686 | - u'owner': u'user0', |
2687 | - u'created_on': u'2008-07-28 12:42:52', |
2688 | - u'timeout': 144, |
2689 | - u'synch_count': 1, |
2690 | - u'id': 5964}])], |
2691 | + [{'status_counts': {'Completed': 1}, |
2692 | + 'control_file': 'kernel = \'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\'\ndef step_init():\n job.next_step([step_test])\n testkernel = job.kernel(\'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\')\n \n testkernel.install()\n testkernel.boot(args=\'console_always_print=1\')\n\ndef step_test():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "Autotest Team"\n NAME = "Sleeptest"\n TIME = "SHORT"\n TEST_CATEGORY = "Functional"\n TEST_CLASS = "General"\n TEST_TYPE = "client"\n \n DOC = """\n This test simply sleeps for 1 second by default. It\'s a good way to test\n profilers and double check that autotest is working.\n The seconds argument can also be modified to make the machine sleep for as\n long as needed.\n """\n \n job.run_test(\'sleeptest\', seconds = 1)', |
2693 | + 'name': 'mytest', |
2694 | + 'control_type': 'Client', |
2695 | + 'run_verify': 1, |
2696 | + 'priority': 'Medium', |
2697 | + 'owner': 'user0', |
2698 | + 'created_on': '2008-07-28 12:42:52', |
2699 | + 'timeout': 144, |
2700 | + 'synch_count': 1, |
2701 | + 'id': 5964}])], |
2702 | out_words_ok=['user0', 'Completed', '1', '5964'], |
2703 | out_words_no=['sleeptest', 'Priority', 'Client', '2008']) |
2704 | |
2705 | @@ -168,17 +168,17 @@ class job_list_unittest(job_unittest): |
2706 | rpcs=[('get_jobs_summary', {'id__in': ['5964'], |
2707 | 'running': None}, |
2708 | True, |
2709 | - [{u'status_counts': {u'Completed': 1}, |
2710 | - u'control_file': u'kernel = \'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\'\ndef step_init():\n job.next_step([step_test])\n testkernel = job.kernel(\'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\')\n \n testkernel.install()\n testkernel.boot(args=\'console_always_print=1\')\n\ndef step_test():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "Autotest Team"\n NAME = "Sleeptest"\n TIME = "SHORT"\n TEST_CATEGORY = "Functional"\n TEST_CLASS = "General"\n TEST_TYPE = "client"\n \n DOC = """\n This test simply sleeps for 1 second by default. It\'s a good way to test\n profilers and double check that autotest is working.\n The seconds argument can also be modified to make the machine sleep for as\n long as needed.\n """\n \n job.run_test(\'sleeptest\', seconds = 1)', |
2711 | - u'name': u'mytest', |
2712 | - u'control_type': u'Client', |
2713 | - u'run_verify': 1, |
2714 | - u'priority': u'Medium', |
2715 | - u'owner': u'user0', |
2716 | - u'created_on': u'2008-07-28 12:42:52', |
2717 | - u'timeout': 144, |
2718 | - u'synch_count': 1, |
2719 | - u'id': 5964}])], |
2720 | + [{'status_counts': {'Completed': 1}, |
2721 | + 'control_file': 'kernel = \'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\'\ndef step_init():\n job.next_step([step_test])\n testkernel = job.kernel(\'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\')\n \n testkernel.install()\n testkernel.boot(args=\'console_always_print=1\')\n\ndef step_test():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "Autotest Team"\n NAME = "Sleeptest"\n TIME = "SHORT"\n TEST_CATEGORY = "Functional"\n TEST_CLASS = "General"\n TEST_TYPE = "client"\n \n DOC = """\n This test simply sleeps for 1 second by default. It\'s a good way to test\n profilers and double check that autotest is working.\n The seconds argument can also be modified to make the machine sleep for as\n long as needed.\n """\n \n job.run_test(\'sleeptest\', seconds = 1)', |
2722 | + 'name': 'mytest', |
2723 | + 'control_type': 'Client', |
2724 | + 'run_verify': 1, |
2725 | + 'priority': 'Medium', |
2726 | + 'owner': 'user0', |
2727 | + 'created_on': '2008-07-28 12:42:52', |
2728 | + 'timeout': 144, |
2729 | + 'synch_count': 1, |
2730 | + 'id': 5964}])], |
2731 | out_words_ok=['user0', 'Completed', '1', '5964', |
2732 | 'Client', '2008', 'Priority'], |
2733 | out_words_no=['sleeptest']) |
2734 | @@ -189,17 +189,17 @@ class job_list_unittest(job_unittest): |
2735 | rpcs=[('get_jobs_summary', {'name__startswith': 'myt', |
2736 | 'running': None}, |
2737 | True, |
2738 | - [{u'status_counts': {u'Completed': 1}, |
2739 | - u'control_file': u'kernel = \'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\'\ndef step_init():\n job.next_step([step_test])\n testkernel = job.kernel(\'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\')\n \n testkernel.install()\n testkernel.boot(args=\'console_always_print=1\')\n\ndef step_test():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "Autotest Team"\n NAME = "Sleeptest"\n TIME = "SHORT"\n TEST_CATEGORY = "Functional"\n TEST_CLASS = "General"\n TEST_TYPE = "client"\n \n DOC = """\n This test simply sleeps for 1 second by default. It\'s a good way to test\n profilers and double check that autotest is working.\n The seconds argument can also be modified to make the machine sleep for as\n long as needed.\n """\n \n job.run_test(\'sleeptest\', seconds = 1)', |
2740 | - u'name': u'mytest', |
2741 | - u'control_type': u'Client', |
2742 | - u'run_verify': 1, |
2743 | - u'priority': u'Medium', |
2744 | - u'owner': u'user0', |
2745 | - u'created_on': u'2008-07-28 12:42:52', |
2746 | - u'timeout': 144, |
2747 | - u'synch_count': 1, |
2748 | - u'id': 5964}])], |
2749 | + [{'status_counts': {'Completed': 1}, |
2750 | + 'control_file': 'kernel = \'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\'\ndef step_init():\n job.next_step([step_test])\n testkernel = job.kernel(\'8210088647656509311.kernel-smp-2.6.18-220.5.x86_64.rpm\')\n \n testkernel.install()\n testkernel.boot(args=\'console_always_print=1\')\n\ndef step_test():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "Autotest Team"\n NAME = "Sleeptest"\n TIME = "SHORT"\n TEST_CATEGORY = "Functional"\n TEST_CLASS = "General"\n TEST_TYPE = "client"\n \n DOC = """\n This test simply sleeps for 1 second by default. It\'s a good way to test\n profilers and double check that autotest is working.\n The seconds argument can also be modified to make the machine sleep for as\n long as needed.\n """\n \n job.run_test(\'sleeptest\', seconds = 1)', |
2751 | + 'name': 'mytest', |
2752 | + 'control_type': 'Client', |
2753 | + 'run_verify': 1, |
2754 | + 'priority': 'Medium', |
2755 | + 'owner': 'user0', |
2756 | + 'created_on': '2008-07-28 12:42:52', |
2757 | + 'timeout': 144, |
2758 | + 'synch_count': 1, |
2759 | + 'id': 5964}])], |
2760 | out_words_ok=['user0', 'Completed', '1', '5964'], |
2761 | out_words_no=['sleeptest', 'Priority', 'Client', '2008']) |
2762 | |
2763 | @@ -235,27 +235,27 @@ class job_stat_unittest(job_unittest): |
2764 | [results[0]]), |
2765 | ('get_host_queue_entries', {'job__in': ['180']}, |
2766 | True, |
2767 | - [{u'status': u'Failed', |
2768 | - u'complete': 1, |
2769 | - u'host': {u'status': u'Repair Failed', |
2770 | - u'locked': False, |
2771 | - u'hostname': u'host0', |
2772 | - u'invalid': True, |
2773 | - u'id': 4432, |
2774 | - u'synch_id': None}, |
2775 | - u'priority': 1, |
2776 | - u'meta_host': None, |
2777 | - u'job': {u'control_file': u"def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
2778 | - u'name': u'test_sleep', |
2779 | - u'control_type': u'Server', |
2780 | - u'synchronizing': 0, |
2781 | - u'priority': u'Medium', |
2782 | - u'owner': u'user0', |
2783 | - u'created_on': u'2008-03-18 11:27:29', |
2784 | - u'synch_count': 1, |
2785 | - u'id': 180}, |
2786 | - u'active': 0, |
2787 | - u'id': 101084}])], |
2788 | + [{'status': 'Failed', |
2789 | + 'complete': 1, |
2790 | + 'host': {'status': 'Repair Failed', |
2791 | + 'locked': False, |
2792 | + 'hostname': 'host0', |
2793 | + 'invalid': True, |
2794 | + 'id': 4432, |
2795 | + 'synch_id': None}, |
2796 | + 'priority': 1, |
2797 | + 'meta_host': None, |
2798 | + 'job': {'control_file': "def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
2799 | + 'name': 'test_sleep', |
2800 | + 'control_type': 'Server', |
2801 | + 'synchronizing': 0, |
2802 | + 'priority': 'Medium', |
2803 | + 'owner': 'user0', |
2804 | + 'created_on': '2008-03-18 11:27:29', |
2805 | + 'synch_count': 1, |
2806 | + 'id': 180}, |
2807 | + 'active': 0, |
2808 | + 'id': 101084}])], |
2809 | out_words_ok=['test_job0', 'host0', 'Failed', |
2810 | 'Aborted']) |
2811 | |
2812 | @@ -263,37 +263,37 @@ class job_stat_unittest(job_unittest): |
2813 | self.run_cmd(argv=['atest', 'job', 'stat', '6761', |
2814 | '--list-hosts', '--ignore_site_file'], |
2815 | rpcs=[('get_jobs_summary', {'id__in': ['6761']}, True, |
2816 | - [{u'status_counts': {u'Queued': 1}, |
2817 | - u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2818 | - u'name': u'test_on_meta_hosts', |
2819 | - u'control_type': u'Client', |
2820 | - u'run_verify': 1, |
2821 | - u'priority': u'Medium', |
2822 | - u'owner': u'user0', |
2823 | - u'created_on': u'2008-07-30 22:15:43', |
2824 | - u'timeout': 144, |
2825 | - u'synch_count': 1, |
2826 | - u'id': 6761}]), |
2827 | + [{'status_counts': {'Queued': 1}, |
2828 | + 'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2829 | + 'name': 'test_on_meta_hosts', |
2830 | + 'control_type': 'Client', |
2831 | + 'run_verify': 1, |
2832 | + 'priority': 'Medium', |
2833 | + 'owner': 'user0', |
2834 | + 'created_on': '2008-07-30 22:15:43', |
2835 | + 'timeout': 144, |
2836 | + 'synch_count': 1, |
2837 | + 'id': 6761}]), |
2838 | ('get_host_queue_entries', {'job__in': ['6761']}, |
2839 | True, |
2840 | - [{u'status': u'Queued', |
2841 | - u'complete': 0, |
2842 | - u'deleted': 0, |
2843 | - u'host': None, |
2844 | - u'priority': 1, |
2845 | - u'meta_host': u'Xeon', |
2846 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2847 | - u'name': u'test_on_meta_hosts', |
2848 | - u'control_type': u'Client', |
2849 | - u'run_verify': 1, |
2850 | - u'priority': u'Medium', |
2851 | - u'owner': u'user0', |
2852 | - u'created_on': u'2008-07-30 22:15:43', |
2853 | - u'timeout': 144, |
2854 | - u'synch_count': 1, |
2855 | - u'id': 6761}, |
2856 | - u'active': 0, |
2857 | - u'id': 193166}])], |
2858 | + [{'status': 'Queued', |
2859 | + 'complete': 0, |
2860 | + 'deleted': 0, |
2861 | + 'host': None, |
2862 | + 'priority': 1, |
2863 | + 'meta_host': 'Xeon', |
2864 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2865 | + 'name': 'test_on_meta_hosts', |
2866 | + 'control_type': 'Client', |
2867 | + 'run_verify': 1, |
2868 | + 'priority': 'Medium', |
2869 | + 'owner': 'user0', |
2870 | + 'created_on': '2008-07-30 22:15:43', |
2871 | + 'timeout': 144, |
2872 | + 'synch_count': 1, |
2873 | + 'id': 6761}, |
2874 | + 'active': 0, |
2875 | + 'id': 193166}])], |
2876 | err_words_ok=['unassigned', 'meta-hosts'], |
2877 | out_words_no=['Xeon']) |
2878 | |
2879 | @@ -301,71 +301,71 @@ class job_stat_unittest(job_unittest): |
2880 | self.run_cmd(argv=['atest', 'job', 'stat', '6761', |
2881 | '--list-hosts', '--ignore_site_file'], |
2882 | rpcs=[('get_jobs_summary', {'id__in': ['6761']}, True, |
2883 | - [{u'status_counts': {u'Queued': 1}, |
2884 | - u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2885 | - u'name': u'test_on_meta_hosts', |
2886 | - u'control_type': u'Client', |
2887 | - u'run_verify': 1, |
2888 | - u'priority': u'Medium', |
2889 | - u'owner': u'user0', |
2890 | - u'created_on': u'2008-07-30 22:15:43', |
2891 | - u'timeout': 144, |
2892 | - u'synch_count': 1, |
2893 | - u'id': 6761}]), |
2894 | + [{'status_counts': {'Queued': 1}, |
2895 | + 'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2896 | + 'name': 'test_on_meta_hosts', |
2897 | + 'control_type': 'Client', |
2898 | + 'run_verify': 1, |
2899 | + 'priority': 'Medium', |
2900 | + 'owner': 'user0', |
2901 | + 'created_on': '2008-07-30 22:15:43', |
2902 | + 'timeout': 144, |
2903 | + 'synch_count': 1, |
2904 | + 'id': 6761}]), |
2905 | ('get_host_queue_entries', {'job__in': ['6761']}, |
2906 | True, |
2907 | - [{u'status': u'Queued', |
2908 | - u'complete': 0, |
2909 | - u'deleted': 0, |
2910 | - u'host': {u'status': u'Running', |
2911 | - u'lock_time': None, |
2912 | - u'hostname': u'host41', |
2913 | - u'locked': False, |
2914 | - u'locked_by': None, |
2915 | - u'invalid': False, |
2916 | - u'id': 4833, |
2917 | - u'protection': u'Repair filesystem only', |
2918 | - u'synch_id': None}, |
2919 | - u'priority': 1, |
2920 | - u'meta_host': u'Xeon', |
2921 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2922 | - u'name': u'test_on_meta_hosts', |
2923 | - u'control_type': u'Client', |
2924 | - u'run_verify': 1, |
2925 | - u'priority': u'Medium', |
2926 | - u'owner': u'user0', |
2927 | - u'created_on': u'2008-07-30 22:15:43', |
2928 | - u'timeout': 144, |
2929 | - u'synch_count': 1, |
2930 | - u'id': 6761}, |
2931 | - u'active': 0, |
2932 | - u'id': 193166}, |
2933 | - {u'status': u'Running', |
2934 | - u'complete': 0, |
2935 | - u'deleted': 0, |
2936 | - u'host': {u'status': u'Running', |
2937 | - u'lock_time': None, |
2938 | - u'hostname': u'host42', |
2939 | - u'locked': False, |
2940 | - u'locked_by': None, |
2941 | - u'invalid': False, |
2942 | - u'id': 4833, |
2943 | - u'protection': u'Repair filesystem only', |
2944 | - u'synch_id': None}, |
2945 | - u'priority': 1, |
2946 | - u'meta_host': u'Xeon', |
2947 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2948 | - u'name': u'test_on_meta_hosts', |
2949 | - u'control_type': u'Client', |
2950 | - u'run_verify': 1, |
2951 | - u'priority': u'Medium', |
2952 | - u'owner': u'user0', |
2953 | - u'created_on': u'2008-07-30 22:15:43', |
2954 | - u'timeout': 144, |
2955 | - u'synch_count': 1, |
2956 | - u'id': 6761}, |
2957 | - u'active': 0, |
2958 | - u'id': 193166}])], |
2959 | + [{'status': 'Queued', |
2960 | + 'complete': 0, |
2961 | + 'deleted': 0, |
2962 | + 'host': {'status': 'Running', |
2963 | + 'lock_time': None, |
2964 | + 'hostname': 'host41', |
2965 | + 'locked': False, |
2966 | + 'locked_by': None, |
2967 | + 'invalid': False, |
2968 | + 'id': 4833, |
2969 | + 'protection': 'Repair filesystem only', |
2970 | + 'synch_id': None}, |
2971 | + 'priority': 1, |
2972 | + 'meta_host': 'Xeon', |
2973 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
2974 | + 'name': 'test_on_meta_hosts', |
2975 | + 'control_type': 'Client', |
2976 | + 'run_verify': 1, |
2977 | + 'priority': 'Medium', |
2978 | + 'owner': 'user0', |
2979 | + 'created_on': '2008-07-30 22:15:43', |
2980 | + 'timeout': 144, |
2981 | + 'synch_count': 1, |
2982 | + 'id': 6761}, |
2983 | + 'active': 0, |
2984 | + 'id': 193166}, |
2985 | + {'status': 'Running', |
2986 | + 'complete': 0, |
2987 | + 'deleted': 0, |
2988 | + 'host': {'status': 'Running', |
2989 | + 'lock_time': None, |
2990 | + 'hostname': 'host42', |
2991 | + 'locked': False, |
2992 | + 'locked_by': None, |
2993 | + 'invalid': False, |
2994 | + 'id': 4833, |
2995 | + 'protection': 'Repair filesystem only', |
2996 | + 'synch_id': None}, |
2997 | + 'priority': 1, |
2998 | + 'meta_host': 'Xeon', |
2999 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3000 | + 'name': 'test_on_meta_hosts', |
3001 | + 'control_type': 'Client', |
3002 | + 'run_verify': 1, |
3003 | + 'priority': 'Medium', |
3004 | + 'owner': 'user0', |
3005 | + 'created_on': '2008-07-30 22:15:43', |
3006 | + 'timeout': 144, |
3007 | + 'synch_count': 1, |
3008 | + 'id': 6761}, |
3009 | + 'active': 0, |
3010 | + 'id': 193166}])], |
3011 | out_words_ok=['host41', 'host42'], |
3012 | out_words_no=['Xeon', 'Running', 'Queued'], |
3013 | err_words_no=['unassigned']) |
3014 | @@ -375,71 +375,71 @@ class job_stat_unittest(job_unittest): |
3015 | '--list-hosts-status', 'Running,Queued', |
3016 | '--ignore_site_file'], |
3017 | rpcs=[('get_jobs_summary', {'id__in': ['6761']}, True, |
3018 | - [{u'status_counts': {u'Queued': 1, u'Running': 1}, |
3019 | - u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3020 | - u'name': u'test', |
3021 | - u'control_type': u'Client', |
3022 | - u'run_verify': 1, |
3023 | - u'priority': u'Medium', |
3024 | - u'owner': u'user0', |
3025 | - u'created_on': u'2008-07-30 22:15:43', |
3026 | - u'timeout': 144, |
3027 | - u'synch_count': 1, |
3028 | - u'id': 6761}]), |
3029 | + [{'status_counts': {'Queued': 1, 'Running': 1}, |
3030 | + 'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3031 | + 'name': 'test', |
3032 | + 'control_type': 'Client', |
3033 | + 'run_verify': 1, |
3034 | + 'priority': 'Medium', |
3035 | + 'owner': 'user0', |
3036 | + 'created_on': '2008-07-30 22:15:43', |
3037 | + 'timeout': 144, |
3038 | + 'synch_count': 1, |
3039 | + 'id': 6761}]), |
3040 | ('get_host_queue_entries', {'job__in': ['6761']}, |
3041 | True, |
3042 | - [{u'status': u'Queued', |
3043 | - u'complete': 0, |
3044 | - u'deleted': 0, |
3045 | - u'host': {u'status': u'Queued', |
3046 | - u'lock_time': None, |
3047 | - u'hostname': u'host41', |
3048 | - u'locked': False, |
3049 | - u'locked_by': None, |
3050 | - u'invalid': False, |
3051 | - u'id': 4833, |
3052 | - u'protection': u'Repair filesystem only', |
3053 | - u'synch_id': None}, |
3054 | - u'priority': 1, |
3055 | - u'meta_host': None, |
3056 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3057 | - u'name': u'test', |
3058 | - u'control_type': u'Client', |
3059 | - u'run_verify': 1, |
3060 | - u'priority': u'Medium', |
3061 | - u'owner': u'user0', |
3062 | - u'created_on': u'2008-07-30 22:15:43', |
3063 | - u'timeout': 144, |
3064 | - u'synch_count': 1, |
3065 | - u'id': 6761}, |
3066 | - u'active': 0, |
3067 | - u'id': 193166}, |
3068 | - {u'status': u'Running', |
3069 | - u'complete': 0, |
3070 | - u'deleted': 0, |
3071 | - u'host': {u'status': u'Running', |
3072 | - u'lock_time': None, |
3073 | - u'hostname': u'host42', |
3074 | - u'locked': False, |
3075 | - u'locked_by': None, |
3076 | - u'invalid': False, |
3077 | - u'id': 4833, |
3078 | - u'protection': u'Repair filesystem only', |
3079 | - u'synch_id': None}, |
3080 | - u'priority': 1, |
3081 | - u'meta_host': None, |
3082 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3083 | - u'name': u'test', |
3084 | - u'control_type': u'Client', |
3085 | - u'run_verify': 1, |
3086 | - u'priority': u'Medium', |
3087 | - u'owner': u'user0', |
3088 | - u'created_on': u'2008-07-30 22:15:43', |
3089 | - u'timeout': 144, |
3090 | - u'synch_count': 1, |
3091 | - u'id': 6761}, |
3092 | - u'active': 0, |
3093 | - u'id': 193166}])], |
3094 | + [{'status': 'Queued', |
3095 | + 'complete': 0, |
3096 | + 'deleted': 0, |
3097 | + 'host': {'status': 'Queued', |
3098 | + 'lock_time': None, |
3099 | + 'hostname': 'host41', |
3100 | + 'locked': False, |
3101 | + 'locked_by': None, |
3102 | + 'invalid': False, |
3103 | + 'id': 4833, |
3104 | + 'protection': 'Repair filesystem only', |
3105 | + 'synch_id': None}, |
3106 | + 'priority': 1, |
3107 | + 'meta_host': None, |
3108 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3109 | + 'name': 'test', |
3110 | + 'control_type': 'Client', |
3111 | + 'run_verify': 1, |
3112 | + 'priority': 'Medium', |
3113 | + 'owner': 'user0', |
3114 | + 'created_on': '2008-07-30 22:15:43', |
3115 | + 'timeout': 144, |
3116 | + 'synch_count': 1, |
3117 | + 'id': 6761}, |
3118 | + 'active': 0, |
3119 | + 'id': 193166}, |
3120 | + {'status': 'Running', |
3121 | + 'complete': 0, |
3122 | + 'deleted': 0, |
3123 | + 'host': {'status': 'Running', |
3124 | + 'lock_time': None, |
3125 | + 'hostname': 'host42', |
3126 | + 'locked': False, |
3127 | + 'locked_by': None, |
3128 | + 'invalid': False, |
3129 | + 'id': 4833, |
3130 | + 'protection': 'Repair filesystem only', |
3131 | + 'synch_id': None}, |
3132 | + 'priority': 1, |
3133 | + 'meta_host': None, |
3134 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3135 | + 'name': 'test', |
3136 | + 'control_type': 'Client', |
3137 | + 'run_verify': 1, |
3138 | + 'priority': 'Medium', |
3139 | + 'owner': 'user0', |
3140 | + 'created_on': '2008-07-30 22:15:43', |
3141 | + 'timeout': 144, |
3142 | + 'synch_count': 1, |
3143 | + 'id': 6761}, |
3144 | + 'active': 0, |
3145 | + 'id': 193166}])], |
3146 | out_words_ok=['Queued', 'Running', 'host41', 'host42'], |
3147 | out_words_no=['Xeon'], |
3148 | err_words_no=['unassigned']) |
3149 | @@ -448,118 +448,118 @@ class job_stat_unittest(job_unittest): |
3150 | self.run_cmd(argv=['atest', 'job', 'stat', '6761', |
3151 | '--ignore_site_file'], |
3152 | rpcs=[('get_jobs_summary', {'id__in': ['6761']}, True, |
3153 | - [{u'status_counts': {u'Running': 1, |
3154 | - u'Queued': 4}, |
3155 | - u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3156 | - u'name': u'test_on_meta_hosts', |
3157 | - u'control_type': u'Client', |
3158 | - u'run_verify': 1, |
3159 | - u'priority': u'Medium', |
3160 | - u'owner': u'user0', |
3161 | - u'created_on': u'2008-07-30 22:15:43', |
3162 | - u'timeout': 144, |
3163 | - u'synch_count': 1, |
3164 | - u'id': 6761}]), |
3165 | + [{'status_counts': {'Running': 1, |
3166 | + 'Queued': 4}, |
3167 | + 'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3168 | + 'name': 'test_on_meta_hosts', |
3169 | + 'control_type': 'Client', |
3170 | + 'run_verify': 1, |
3171 | + 'priority': 'Medium', |
3172 | + 'owner': 'user0', |
3173 | + 'created_on': '2008-07-30 22:15:43', |
3174 | + 'timeout': 144, |
3175 | + 'synch_count': 1, |
3176 | + 'id': 6761}]), |
3177 | ('get_host_queue_entries', {'job__in': ['6761']}, |
3178 | True, |
3179 | - [{u'status': u'Queued', |
3180 | - u'complete': 0, |
3181 | - u'deleted': 0, |
3182 | - u'host': None, |
3183 | - u'priority': 1, |
3184 | - u'meta_host': u'Xeon', |
3185 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3186 | - u'name': u'test_on_meta_hosts', |
3187 | - u'control_type': u'Client', |
3188 | - u'run_verify': 1, |
3189 | - u'priority': u'Medium', |
3190 | - u'owner': u'user0', |
3191 | - u'created_on': u'2008-07-30 22:15:43', |
3192 | - u'timeout': 144, |
3193 | - u'synch_count': 1, |
3194 | - u'id': 6761}, |
3195 | - u'active': 0, |
3196 | - u'id': 193166}, |
3197 | - {u'status': u'Queued', |
3198 | - u'complete': 0, |
3199 | - u'deleted': 0, |
3200 | - u'host': None, |
3201 | - u'priority': 1, |
3202 | - u'meta_host': u'Xeon', |
3203 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3204 | - u'name': u'test_on_meta_hosts', |
3205 | - u'control_type': u'Client', |
3206 | - u'run_verify': 1, |
3207 | - u'priority': u'Medium', |
3208 | - u'owner': u'user0', |
3209 | - u'created_on': u'2008-07-30 22:15:43', |
3210 | - u'timeout': 144, |
3211 | - u'synch_count': 1, |
3212 | - u'id': 6761}, |
3213 | - u'active': 0, |
3214 | - u'id': 193167}, |
3215 | - {u'status': u'Queued', |
3216 | - u'complete': 0, |
3217 | - u'deleted': 0, |
3218 | - u'host': None, |
3219 | - u'priority': 1, |
3220 | - u'meta_host': u'Athlon', |
3221 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3222 | - u'name': u'test_on_meta_hosts', |
3223 | - u'control_type': u'Client', |
3224 | - u'run_verify': 1, |
3225 | - u'priority': u'Medium', |
3226 | - u'owner': u'user0', |
3227 | - u'created_on': u'2008-07-30 22:15:43', |
3228 | - u'timeout': 144, |
3229 | - u'synch_count': 1, |
3230 | - u'id': 6761}, |
3231 | - u'active': 0, |
3232 | - u'id': 193168}, |
3233 | - {u'status': u'Queued', |
3234 | - u'complete': 0, |
3235 | - u'deleted': 0, |
3236 | - u'host': None, |
3237 | - u'priority': 1, |
3238 | - u'meta_host': u'x286', |
3239 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3240 | - u'name': u'test_on_meta_hosts', |
3241 | - u'control_type': u'Client', |
3242 | - u'run_verify': 1, |
3243 | - u'priority': u'Medium', |
3244 | - u'owner': u'user0', |
3245 | - u'created_on': u'2008-07-30 22:15:43', |
3246 | - u'timeout': 144, |
3247 | - u'synch_count': 1, |
3248 | - u'id': 6761}, |
3249 | - u'active': 0, |
3250 | - u'id': 193169}, |
3251 | - {u'status': u'Running', |
3252 | - u'complete': 0, |
3253 | - u'deleted': 0, |
3254 | - u'host': {u'status': u'Running', |
3255 | - u'lock_time': None, |
3256 | - u'hostname': u'host42', |
3257 | - u'locked': False, |
3258 | - u'locked_by': None, |
3259 | - u'invalid': False, |
3260 | - u'id': 4833, |
3261 | - u'protection': u'Repair filesystem only', |
3262 | - u'synch_id': None}, |
3263 | - u'priority': 1, |
3264 | - u'meta_host': u'Athlon', |
3265 | - u'job': {u'control_file': u'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3266 | - u'name': u'test_on_meta_hosts', |
3267 | - u'control_type': u'Client', |
3268 | - u'run_verify': 1, |
3269 | - u'priority': u'Medium', |
3270 | - u'owner': u'user0', |
3271 | - u'created_on': u'2008-07-30 22:15:43', |
3272 | - u'timeout': 144, |
3273 | - u'synch_count': 1, |
3274 | - u'id': 6761}, |
3275 | - u'active': 1, |
3276 | - u'id': 193170}])], |
3277 | + [{'status': 'Queued', |
3278 | + 'complete': 0, |
3279 | + 'deleted': 0, |
3280 | + 'host': None, |
3281 | + 'priority': 1, |
3282 | + 'meta_host': 'Xeon', |
3283 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3284 | + 'name': 'test_on_meta_hosts', |
3285 | + 'control_type': 'Client', |
3286 | + 'run_verify': 1, |
3287 | + 'priority': 'Medium', |
3288 | + 'owner': 'user0', |
3289 | + 'created_on': '2008-07-30 22:15:43', |
3290 | + 'timeout': 144, |
3291 | + 'synch_count': 1, |
3292 | + 'id': 6761}, |
3293 | + 'active': 0, |
3294 | + 'id': 193166}, |
3295 | + {'status': 'Queued', |
3296 | + 'complete': 0, |
3297 | + 'deleted': 0, |
3298 | + 'host': None, |
3299 | + 'priority': 1, |
3300 | + 'meta_host': 'Xeon', |
3301 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3302 | + 'name': 'test_on_meta_hosts', |
3303 | + 'control_type': 'Client', |
3304 | + 'run_verify': 1, |
3305 | + 'priority': 'Medium', |
3306 | + 'owner': 'user0', |
3307 | + 'created_on': '2008-07-30 22:15:43', |
3308 | + 'timeout': 144, |
3309 | + 'synch_count': 1, |
3310 | + 'id': 6761}, |
3311 | + 'active': 0, |
3312 | + 'id': 193167}, |
3313 | + {'status': 'Queued', |
3314 | + 'complete': 0, |
3315 | + 'deleted': 0, |
3316 | + 'host': None, |
3317 | + 'priority': 1, |
3318 | + 'meta_host': 'Athlon', |
3319 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3320 | + 'name': 'test_on_meta_hosts', |
3321 | + 'control_type': 'Client', |
3322 | + 'run_verify': 1, |
3323 | + 'priority': 'Medium', |
3324 | + 'owner': 'user0', |
3325 | + 'created_on': '2008-07-30 22:15:43', |
3326 | + 'timeout': 144, |
3327 | + 'synch_count': 1, |
3328 | + 'id': 6761}, |
3329 | + 'active': 0, |
3330 | + 'id': 193168}, |
3331 | + {'status': 'Queued', |
3332 | + 'complete': 0, |
3333 | + 'deleted': 0, |
3334 | + 'host': None, |
3335 | + 'priority': 1, |
3336 | + 'meta_host': 'x286', |
3337 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3338 | + 'name': 'test_on_meta_hosts', |
3339 | + 'control_type': 'Client', |
3340 | + 'run_verify': 1, |
3341 | + 'priority': 'Medium', |
3342 | + 'owner': 'user0', |
3343 | + 'created_on': '2008-07-30 22:15:43', |
3344 | + 'timeout': 144, |
3345 | + 'synch_count': 1, |
3346 | + 'id': 6761}, |
3347 | + 'active': 0, |
3348 | + 'id': 193169}, |
3349 | + {'status': 'Running', |
3350 | + 'complete': 0, |
3351 | + 'deleted': 0, |
3352 | + 'host': {'status': 'Running', |
3353 | + 'lock_time': None, |
3354 | + 'hostname': 'host42', |
3355 | + 'locked': False, |
3356 | + 'locked_by': None, |
3357 | + 'invalid': False, |
3358 | + 'id': 4833, |
3359 | + 'protection': 'Repair filesystem only', |
3360 | + 'synch_id': None}, |
3361 | + 'priority': 1, |
3362 | + 'meta_host': 'Athlon', |
3363 | + 'job': {'control_file': 'def step_init():\n job.next_step(\'step0\')\n\ndef step0():\n AUTHOR = "mbligh@google.com (Martin Bligh)"\n NAME = "Kernbench"\n TIME = "SHORT"\n TEST_CLASS = "Kernel"\n TEST_CATEGORY = "Benchmark"\n TEST_TYPE = "client"\n \n DOC = """\n A standard CPU benchmark. Runs a kernel compile and measures the performance.\n """\n \n job.run_test(\'kernbench\')', |
3364 | + 'name': 'test_on_meta_hosts', |
3365 | + 'control_type': 'Client', |
3366 | + 'run_verify': 1, |
3367 | + 'priority': 'Medium', |
3368 | + 'owner': 'user0', |
3369 | + 'created_on': '2008-07-30 22:15:43', |
3370 | + 'timeout': 144, |
3371 | + 'synch_count': 1, |
3372 | + 'id': 6761}, |
3373 | + 'active': 1, |
3374 | + 'id': 193170}])], |
3375 | out_words_ok=['test_on_meta_hosts', |
3376 | 'host42', 'Queued', 'Running'], |
3377 | out_words_no=['Athlon', 'Xeon', 'x286']) |
3378 | @@ -572,21 +572,21 @@ class job_stat_unittest(job_unittest): |
3379 | [results[0]]), |
3380 | ('get_host_queue_entries', {'job__in': ['180']}, |
3381 | True, |
3382 | - [{u'status': u'Failed', |
3383 | - u'complete': 1, |
3384 | - u'host': None, |
3385 | - u'priority': 1, |
3386 | - u'meta_host': None, |
3387 | - u'job': {u'control_file': u"def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3388 | - u'name': u'test_sleep', |
3389 | - u'control_type': u'Server', |
3390 | - u'priority': u'Medium', |
3391 | - u'owner': u'user0', |
3392 | - u'created_on': u'2008-03-18 11:27:29', |
3393 | - u'synch_count': 1, |
3394 | - u'id': 180}, |
3395 | - u'active': 0, |
3396 | - u'id': 101084}])], |
3397 | + [{'status': 'Failed', |
3398 | + 'complete': 1, |
3399 | + 'host': None, |
3400 | + 'priority': 1, |
3401 | + 'meta_host': None, |
3402 | + 'job': {'control_file': "def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3403 | + 'name': 'test_sleep', |
3404 | + 'control_type': 'Server', |
3405 | + 'priority': 'Medium', |
3406 | + 'owner': 'user0', |
3407 | + 'created_on': '2008-03-18 11:27:29', |
3408 | + 'synch_count': 1, |
3409 | + 'id': 180}, |
3410 | + 'active': 0, |
3411 | + 'id': 101084}])], |
3412 | err_words_ok=['unassigned', 'meta-hosts']) |
3413 | |
3414 | def test_job_stat_multi_jobs(self): |
3415 | @@ -598,46 +598,46 @@ class job_stat_unittest(job_unittest): |
3416 | ('get_host_queue_entries', |
3417 | {'job__in': ['180', '338']}, |
3418 | True, |
3419 | - [{u'status': u'Failed', |
3420 | - u'complete': 1, |
3421 | - u'host': {u'status': u'Repair Failed', |
3422 | - u'locked': False, |
3423 | - u'hostname': u'host0', |
3424 | - u'invalid': True, |
3425 | - u'id': 4432, |
3426 | - u'synch_id': None}, |
3427 | - u'priority': 1, |
3428 | - u'meta_host': None, |
3429 | - u'job': {u'control_file': u"def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3430 | - u'name': u'test_sleep', |
3431 | - u'control_type': u'Server', |
3432 | - u'priority': u'Medium', |
3433 | - u'owner': u'user0', |
3434 | - u'created_on': u'2008-03-18 11:27:29', |
3435 | - u'synch_count': 1, |
3436 | - u'id': 180}, |
3437 | - u'active': 0, |
3438 | - u'id': 101084}, |
3439 | - {u'status': u'Failed', |
3440 | - u'complete': 1, |
3441 | - u'host': {u'status': u'Repair Failed', |
3442 | - u'locked': False, |
3443 | - u'hostname': u'host10', |
3444 | - u'invalid': True, |
3445 | - u'id': 4432, |
3446 | - u'synch_id': None}, |
3447 | - u'priority': 1, |
3448 | - u'meta_host': None, |
3449 | - u'job': {u'control_file': u"def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3450 | - u'name': u'test_sleep', |
3451 | - u'control_type': u'Server', |
3452 | - u'priority': u'Medium', |
3453 | - u'owner': u'user0', |
3454 | - u'created_on': u'2008-03-18 11:27:29', |
3455 | - u'synch_count': 1, |
3456 | - u'id': 338}, |
3457 | - u'active': 0, |
3458 | - u'id': 101084}])], |
3459 | + [{'status': 'Failed', |
3460 | + 'complete': 1, |
3461 | + 'host': {'status': 'Repair Failed', |
3462 | + 'locked': False, |
3463 | + 'hostname': 'host0', |
3464 | + 'invalid': True, |
3465 | + 'id': 4432, |
3466 | + 'synch_id': None}, |
3467 | + 'priority': 1, |
3468 | + 'meta_host': None, |
3469 | + 'job': {'control_file': "def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3470 | + 'name': 'test_sleep', |
3471 | + 'control_type': 'Server', |
3472 | + 'priority': 'Medium', |
3473 | + 'owner': 'user0', |
3474 | + 'created_on': '2008-03-18 11:27:29', |
3475 | + 'synch_count': 1, |
3476 | + 'id': 180}, |
3477 | + 'active': 0, |
3478 | + 'id': 101084}, |
3479 | + {'status': 'Failed', |
3480 | + 'complete': 1, |
3481 | + 'host': {'status': 'Repair Failed', |
3482 | + 'locked': False, |
3483 | + 'hostname': 'host10', |
3484 | + 'invalid': True, |
3485 | + 'id': 4432, |
3486 | + 'synch_id': None}, |
3487 | + 'priority': 1, |
3488 | + 'meta_host': None, |
3489 | + 'job': {'control_file': "def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3490 | + 'name': 'test_sleep', |
3491 | + 'control_type': 'Server', |
3492 | + 'priority': 'Medium', |
3493 | + 'owner': 'user0', |
3494 | + 'created_on': '2008-03-18 11:27:29', |
3495 | + 'synch_count': 1, |
3496 | + 'id': 338}, |
3497 | + 'active': 0, |
3498 | + 'id': 101084}])], |
3499 | out_words_ok=['test_job0', 'test_job1']) |
3500 | |
3501 | def test_job_stat_multi_jobs_name_id(self): |
3502 | @@ -645,79 +645,79 @@ class job_stat_unittest(job_unittest): |
3503 | '--ignore_site_file'], |
3504 | rpcs=[('get_jobs_summary', {'id__in': ['180']}, |
3505 | True, |
3506 | - [{u'status_counts': {u'Aborted': 1}, |
3507 | - u'control_file': |
3508 | - u"job.run_test('sleeptest')\n", |
3509 | - u'name': u'job0', |
3510 | - u'control_type': u'Server', |
3511 | - u'priority': |
3512 | - u'Medium', |
3513 | - u'owner': u'user0', |
3514 | - u'created_on': |
3515 | - u'2008-07-08 17:45:44', |
3516 | - u'synch_count': 2, |
3517 | - u'id': 180}]), |
3518 | + [{'status_counts': {'Aborted': 1}, |
3519 | + 'control_file': |
3520 | + "job.run_test('sleeptest')\n", |
3521 | + 'name': 'job0', |
3522 | + 'control_type': 'Server', |
3523 | + 'priority': |
3524 | + 'Medium', |
3525 | + 'owner': 'user0', |
3526 | + 'created_on': |
3527 | + '2008-07-08 17:45:44', |
3528 | + 'synch_count': 2, |
3529 | + 'id': 180}]), |
3530 | ('get_jobs_summary', {'name__in': ['mytest']}, |
3531 | True, |
3532 | - [{u'status_counts': {u'Queued': 1}, |
3533 | - u'control_file': |
3534 | - u"job.run_test('sleeptest')\n", |
3535 | - u'name': u'mytest', |
3536 | - u'control_type': u'Client', |
3537 | - u'priority': |
3538 | - u'High', |
3539 | - u'owner': u'user0', |
3540 | - u'created_on': u'2008-07-08 12:17:47', |
3541 | - u'synch_count': 1, |
3542 | - u'id': 338}]), |
3543 | + [{'status_counts': {'Queued': 1}, |
3544 | + 'control_file': |
3545 | + "job.run_test('sleeptest')\n", |
3546 | + 'name': 'mytest', |
3547 | + 'control_type': 'Client', |
3548 | + 'priority': |
3549 | + 'High', |
3550 | + 'owner': 'user0', |
3551 | + 'created_on': '2008-07-08 12:17:47', |
3552 | + 'synch_count': 1, |
3553 | + 'id': 338}]), |
3554 | ('get_host_queue_entries', |
3555 | {'job__in': ['180']}, |
3556 | True, |
3557 | - [{u'status': u'Failed', |
3558 | - u'complete': 1, |
3559 | - u'host': {u'status': u'Repair Failed', |
3560 | - u'locked': False, |
3561 | - u'hostname': u'host0', |
3562 | - u'invalid': True, |
3563 | - u'id': 4432, |
3564 | - u'synch_id': None}, |
3565 | - u'priority': 1, |
3566 | - u'meta_host': None, |
3567 | - u'job': {u'control_file': u"def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3568 | - u'name': u'test_sleep', |
3569 | - u'control_type': u'Server', |
3570 | - u'synchronizing': 0, |
3571 | - u'priority': u'Medium', |
3572 | - u'owner': u'user0', |
3573 | - u'created_on': u'2008-03-18 11:27:29', |
3574 | - u'synch_count': 1, |
3575 | - u'id': 180}, |
3576 | - u'active': 0, |
3577 | - u'id': 101084}]), |
3578 | + [{'status': 'Failed', |
3579 | + 'complete': 1, |
3580 | + 'host': {'status': 'Repair Failed', |
3581 | + 'locked': False, |
3582 | + 'hostname': 'host0', |
3583 | + 'invalid': True, |
3584 | + 'id': 4432, |
3585 | + 'synch_id': None}, |
3586 | + 'priority': 1, |
3587 | + 'meta_host': None, |
3588 | + 'job': {'control_file': "def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3589 | + 'name': 'test_sleep', |
3590 | + 'control_type': 'Server', |
3591 | + 'synchronizing': 0, |
3592 | + 'priority': 'Medium', |
3593 | + 'owner': 'user0', |
3594 | + 'created_on': '2008-03-18 11:27:29', |
3595 | + 'synch_count': 1, |
3596 | + 'id': 180}, |
3597 | + 'active': 0, |
3598 | + 'id': 101084}]), |
3599 | ('get_host_queue_entries', |
3600 | {'job__name__in': ['mytest']}, |
3601 | True, |
3602 | - [{u'status': u'Failed', |
3603 | - u'complete': 1, |
3604 | - u'host': {u'status': u'Repair Failed', |
3605 | - u'locked': False, |
3606 | - u'hostname': u'host10', |
3607 | - u'invalid': True, |
3608 | - u'id': 4432, |
3609 | - u'synch_id': None}, |
3610 | - u'priority': 1, |
3611 | - u'meta_host': None, |
3612 | - u'job': {u'control_file': u"def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3613 | - u'name': u'test_sleep', |
3614 | - u'control_type': u'Server', |
3615 | - u'synchronizing': 0, |
3616 | - u'priority': u'Medium', |
3617 | - u'owner': u'user0', |
3618 | - u'created_on': u'2008-03-18 11:27:29', |
3619 | - u'synch_count': 1, |
3620 | - u'id': 338}, |
3621 | - u'active': 0, |
3622 | - u'id': 101084}])], |
3623 | + [{'status': 'Failed', |
3624 | + 'complete': 1, |
3625 | + 'host': {'status': 'Repair Failed', |
3626 | + 'locked': False, |
3627 | + 'hostname': 'host10', |
3628 | + 'invalid': True, |
3629 | + 'id': 4432, |
3630 | + 'synch_id': None}, |
3631 | + 'priority': 1, |
3632 | + 'meta_host': None, |
3633 | + 'job': {'control_file': "def run(machine):\n\thost = hosts.create_host(machine)\n\tat = autotest_remote.Autotest(host)\n\tat.run_test('sleeptest')\n\nparallel_simple(run, machines)", |
3634 | + 'name': 'test_sleep', |
3635 | + 'control_type': 'Server', |
3636 | + 'synchronizing': 0, |
3637 | + 'priority': 'Medium', |
3638 | + 'owner': 'user0', |
3639 | + 'created_on': '2008-03-18 11:27:29', |
3640 | + 'synch_count': 1, |
3641 | + 'id': 338}, |
3642 | + 'active': 0, |
3643 | + 'id': 101084}])], |
3644 | out_words_ok=['job0', 'mytest', 'Aborted', 'Queued', |
3645 | 'Failed', 'Medium', 'High']) |
3646 | |
3647 | @@ -1187,20 +1187,20 @@ class job_create_unittest(cli_mock.cli_unittest): |
3648 | '--ignore_site_file'], |
3649 | rpcs=[('get_hosts', {'multiple_labels': ['label1', |
3650 | 'label2']}, True, |
3651 | - [{u'status': u'Running', u'lock_time': None, |
3652 | - u'hostname': u'host1', u'locked': False, |
3653 | - u'locked_by': None, u'invalid': False, u'id': 42, |
3654 | - u'labels': [u'label1'], u'platform': |
3655 | - u'Warp18_Diskfull', u'protection': |
3656 | - u'Repair software only', u'dirty': |
3657 | - True, u'synch_id': None}, |
3658 | - {u'status': u'Running', u'lock_time': None, |
3659 | - u'hostname': u'host2', u'locked': False, |
3660 | - u'locked_by': None, u'invalid': False, u'id': 43, |
3661 | - u'labels': [u'label2'], u'platform': |
3662 | - u'Warp18_Diskfull', u'protection': |
3663 | - u'Repair software only', u'dirty': True, |
3664 | - u'synch_id': None}]), |
3665 | + [{'status': 'Running', 'lock_time': None, |
3666 | + 'hostname': 'host1', 'locked': False, |
3667 | + 'locked_by': None, 'invalid': False, 'id': 42, |
3668 | + 'labels': ['label1'], 'platform': |
3669 | + 'Warp18_Diskfull', 'protection': |
3670 | + 'Repair software only', 'dirty': |
3671 | + True, 'synch_id': None}, |
3672 | + {'status': 'Running', 'lock_time': None, |
3673 | + 'hostname': 'host2', 'locked': False, |
3674 | + 'locked_by': None, 'invalid': False, 'id': 43, |
3675 | + 'labels': ['label2'], 'platform': |
3676 | + 'Warp18_Diskfull', 'protection': |
3677 | + 'Repair software only', 'dirty': True, |
3678 | + 'synch_id': None}]), |
3679 | ('create_job', data, True, 42)], |
3680 | out_words_ok=['test_job0', 'Created'], |
3681 | out_words_no=['Uploading', 'Done']) |
3682 | @@ -1214,13 +1214,13 @@ class job_create_unittest(cli_mock.cli_unittest): |
3683 | 'test_job0', '-m', 'host0,host1', '-b', 'label1', |
3684 | '--ignore_site_file'], |
3685 | rpcs=[('get_hosts', {'multiple_labels': ['label1']}, True, |
3686 | - [{u'status': u'Running', u'lock_time': None, |
3687 | - u'hostname': u'host1', u'locked': False, |
3688 | - u'locked_by': None, u'invalid': False, u'id': 42, |
3689 | - u'labels': [u'label1'], u'platform': |
3690 | - u'Warp18_Diskfull', u'protection': |
3691 | - u'Repair software only', u'dirty': |
3692 | - True, u'synch_id': None}]), |
3693 | + [{'status': 'Running', 'lock_time': None, |
3694 | + 'hostname': 'host1', 'locked': False, |
3695 | + 'locked_by': None, 'invalid': False, 'id': 42, |
3696 | + 'labels': ['label1'], 'platform': |
3697 | + 'Warp18_Diskfull', 'protection': |
3698 | + 'Repair software only', 'dirty': |
3699 | + True, 'synch_id': None}]), |
3700 | ('create_job', data, True, 42)], |
3701 | out_words_ok=['test_job0', 'Created'], |
3702 | out_words_no=['Uploading', 'Done']) |
3703 | @@ -1235,13 +1235,13 @@ class job_create_unittest(cli_mock.cli_unittest): |
3704 | 'label1,label\\,2', '--ignore_site_file'], |
3705 | rpcs=[('get_hosts', {'multiple_labels': ['label1', |
3706 | 'label,2']}, True, |
3707 | - [{u'status': u'Running', u'lock_time': None, |
3708 | - u'hostname': u'host1', u'locked': False, |
3709 | - u'locked_by': None, u'invalid': False, u'id': 42, |
3710 | - u'labels': [u'label1', u'label,2'], u'platform': |
3711 | - u'Warp18_Diskfull', u'protection': |
3712 | - u'Repair software only', u'dirty': |
3713 | - True, u'synch_id': None}]), |
3714 | + [{'status': 'Running', 'lock_time': None, |
3715 | + 'hostname': 'host1', 'locked': False, |
3716 | + 'locked_by': None, 'invalid': False, 'id': 42, |
3717 | + 'labels': ['label1', 'label,2'], 'platform': |
3718 | + 'Warp18_Diskfull', 'protection': |
3719 | + 'Repair software only', 'dirty': |
3720 | + True, 'synch_id': None}]), |
3721 | ('create_job', data, True, 42)], |
3722 | out_words_ok=['test_job0', 'Created'], |
3723 | out_words_no=['Uploading', 'Done']) |
3724 | @@ -1256,13 +1256,13 @@ class job_create_unittest(cli_mock.cli_unittest): |
3725 | 'label1,label\\,2\\\\,label3', '--ignore_site_file'], |
3726 | rpcs=[('get_hosts', {'multiple_labels': ['label,2\\', |
3727 | 'label1', 'label3']}, True, |
3728 | - [{u'status': u'Running', u'lock_time': None, |
3729 | - u'hostname': u'host1', u'locked': False, |
3730 | - u'locked_by': None, u'invalid': False, u'id': 42, |
3731 | - u'labels': [u'label1', u'label,2\\', u'label3'], |
3732 | - u'platform': u'Warp18_Diskfull', u'protection': |
3733 | - u'Repair software only', u'dirty': |
3734 | - True, u'synch_id': None}]), |
3735 | + [{'status': 'Running', 'lock_time': None, |
3736 | + 'hostname': 'host1', 'locked': False, |
3737 | + 'locked_by': None, 'invalid': False, 'id': 42, |
3738 | + 'labels': ['label1', 'label,2\\', 'label3'], |
3739 | + 'platform': 'Warp18_Diskfull', 'protection': |
3740 | + 'Repair software only', 'dirty': |
3741 | + True, 'synch_id': None}]), |
3742 | ('create_job', data, True, 42)], |
3743 | out_words_ok=['test_job0', 'Created'], |
3744 | out_words_no=['Uploading', 'Done']) |
3745 | @@ -1296,16 +1296,16 @@ class job_create_unittest(cli_mock.cli_unittest): |
3746 | ['meta0'] * 5 + ['meta1'] * 2 + ['meta2']) |
3747 | |
3748 | def test_parse_hosts_metas_labels_wildcards(self): |
3749 | - values = [{u'id': 180, |
3750 | - u'platform': False, |
3751 | - u'name': u'label0', |
3752 | - u'invalid': False, |
3753 | - u'kernel_config': u''}, |
3754 | - {u'id': 338, |
3755 | - u'platform': False, |
3756 | - u'name': u'label1', |
3757 | - u'invalid': False, |
3758 | - u'kernel_config': u''}] |
3759 | + values = [{'id': 180, |
3760 | + 'platform': False, |
3761 | + 'name': 'label0', |
3762 | + 'invalid': False, |
3763 | + 'kernel_config': ''}, |
3764 | + {'id': 338, |
3765 | + 'platform': False, |
3766 | + 'name': 'label1', |
3767 | + 'invalid': False, |
3768 | + 'kernel_config': ''}] |
3769 | testjob = job.job_create_or_clone() |
3770 | testjob.afe = rpc.afe_comm() |
3771 | self.mock_rpcs([('get_labels', {'name__startswith': 'label'}, |
3772 | @@ -1366,51 +1366,51 @@ class job_create_unittest(cli_mock.cli_unittest): |
3773 | |
3774 | |
3775 | class job_clone_unittest(cli_mock.cli_unittest): |
3776 | - job_data = {'control_file': u'NAME = \'Server Sleeptest\'\nAUTHOR = \'mbligh@google.com (Martin Bligh)\'\nTIME = \'SHORT\'\nTEST_CLASS = \'Software\'\nTEST_CATEGORY = \'Functional\'\nTEST_TYPE = \'server\'\nEXPERIMENTAL = \'False\'\n\nDOC = """\nruns sleep for one second on the list of machines.\n"""\n\ndef run(machine):\n host = hosts.create_host(machine)\n job.run_test(\'sleeptest\')\n\njob.parallel_simple(run, machines)\n', |
3777 | - 'control_type': u'Server', |
3778 | + job_data = {'control_file': 'NAME = \'Server Sleeptest\'\nAUTHOR = \'mbligh@google.com (Martin Bligh)\'\nTIME = \'SHORT\'\nTEST_CLASS = \'Software\'\nTEST_CATEGORY = \'Functional\'\nTEST_TYPE = \'server\'\nEXPERIMENTAL = \'False\'\n\nDOC = """\nruns sleep for one second on the list of machines.\n"""\n\ndef run(machine):\n host = hosts.create_host(machine)\n job.run_test(\'sleeptest\')\n\njob.parallel_simple(run, machines)\n', |
3779 | + 'control_type': 'Server', |
3780 | 'dependencies': [], |
3781 | - 'email_list': u'', |
3782 | + 'email_list': '', |
3783 | 'max_runtime_hrs': 480, |
3784 | 'parse_failed_repair': True, |
3785 | - 'priority': u'Medium', |
3786 | - 'reboot_after': u'Always', |
3787 | - 'reboot_before': u'If dirty', |
3788 | + 'priority': 'Medium', |
3789 | + 'reboot_after': 'Always', |
3790 | + 'reboot_before': 'If dirty', |
3791 | 'run_verify': True, |
3792 | 'synch_count': 1, |
3793 | 'timeout': 480} |
3794 | |
3795 | - local_hosts = [{u'acls': [u'acl0'], |
3796 | - u'atomic_group': None, |
3797 | - u'attributes': {}, |
3798 | - u'dirty': False, |
3799 | - u'hostname': u'host0', |
3800 | - u'id': 8, |
3801 | - u'invalid': False, |
3802 | - u'labels': [u'label0', u'label1'], |
3803 | - u'lock_time': None, |
3804 | - u'locked': False, |
3805 | - u'locked_by': None, |
3806 | - u'other_labels': u'label0, label1', |
3807 | - u'platform': u'plat0', |
3808 | - u'protection': u'Repair software only', |
3809 | - u'status': u'Ready', |
3810 | - u'synch_id': None}, |
3811 | - {u'acls': [u'acl0'], |
3812 | - u'atomic_group': None, |
3813 | - u'attributes': {}, |
3814 | - u'dirty': False, |
3815 | - u'hostname': u'host1', |
3816 | - u'id': 9, |
3817 | - u'invalid': False, |
3818 | - u'labels': [u'label0', u'label1'], |
3819 | - u'lock_time': None, |
3820 | - u'locked': False, |
3821 | - u'locked_by': None, |
3822 | - u'other_labels': u'label0, label1', |
3823 | - u'platform': u'plat0', |
3824 | - u'protection': u'Repair software only', |
3825 | - u'status': u'Ready', |
3826 | - u'synch_id': None}] |
3827 | + local_hosts = [{'acls': ['acl0'], |
3828 | + 'atomic_group': None, |
3829 | + 'attributes': {}, |
3830 | + 'dirty': False, |
3831 | + 'hostname': 'host0', |
3832 | + 'id': 8, |
3833 | + 'invalid': False, |
3834 | + 'labels': ['label0', 'label1'], |
3835 | + 'lock_time': None, |
3836 | + 'locked': False, |
3837 | + 'locked_by': None, |
3838 | + 'other_labels': 'label0, label1', |
3839 | + 'platform': 'plat0', |
3840 | + 'protection': 'Repair software only', |
3841 | + 'status': 'Ready', |
3842 | + 'synch_id': None}, |
3843 | + {'acls': ['acl0'], |
3844 | + 'atomic_group': None, |
3845 | + 'attributes': {}, |
3846 | + 'dirty': False, |
3847 | + 'hostname': 'host1', |
3848 | + 'id': 9, |
3849 | + 'invalid': False, |
3850 | + 'labels': ['label0', 'label1'], |
3851 | + 'lock_time': None, |
3852 | + 'locked': False, |
3853 | + 'locked_by': None, |
3854 | + 'other_labels': 'label0, label1', |
3855 | + 'platform': 'plat0', |
3856 | + 'protection': 'Repair software only', |
3857 | + 'status': 'Ready', |
3858 | + 'synch_id': None}] |
3859 | |
3860 | def setUp(self): |
3861 | super(job_clone_unittest, self).setUp() |
3862 | @@ -1422,7 +1422,7 @@ class job_clone_unittest(cli_mock.cli_unittest): |
3863 | |
3864 | self.job_data_cloned = copy.deepcopy(self.job_data) |
3865 | self.job_data_cloned['name'] = 'cloned' |
3866 | - self.job_data_cloned['hosts'] = [u'host0'] |
3867 | + self.job_data_cloned['hosts'] = ['host0'] |
3868 | self.job_data_cloned['meta_hosts'] = [] |
3869 | |
3870 | def test_backward_compat(self): |
3871 | @@ -1431,39 +1431,39 @@ class job_clone_unittest(cli_mock.cli_unittest): |
3872 | rpcs=[('get_info_for_clone', {'id': '42', |
3873 | 'preserve_metahosts': True}, |
3874 | True, |
3875 | - {u'atomic_group_name': None, |
3876 | - u'hosts': [{u'acls': [u'acl0'], |
3877 | - u'atomic_group': None, |
3878 | - u'attributes': {}, |
3879 | - u'dirty': False, |
3880 | - u'hostname': u'host0', |
3881 | - u'id': 4378, |
3882 | - u'invalid': False, |
3883 | - u'labels': [u'label0', u'label1'], |
3884 | - u'lock_time': None, |
3885 | - u'locked': False, |
3886 | - u'locked_by': None, |
3887 | - u'other_labels': u'label0, label1', |
3888 | - u'platform': u'plat0', |
3889 | - u'protection': u'Repair software only', |
3890 | - u'status': u'Ready', |
3891 | - u'synch_id': None}], |
3892 | - u'job': self.job_data_clone_info, |
3893 | - u'meta_host_counts': {}}), |
3894 | + {'atomic_group_name': None, |
3895 | + 'hosts': [{'acls': ['acl0'], |
3896 | + 'atomic_group': None, |
3897 | + 'attributes': {}, |
3898 | + 'dirty': False, |
3899 | + 'hostname': 'host0', |
3900 | + 'id': 4378, |
3901 | + 'invalid': False, |
3902 | + 'labels': ['label0', 'label1'], |
3903 | + 'lock_time': None, |
3904 | + 'locked': False, |
3905 | + 'locked_by': None, |
3906 | + 'other_labels': 'label0, label1', |
3907 | + 'platform': 'plat0', |
3908 | + 'protection': 'Repair software only', |
3909 | + 'status': 'Ready', |
3910 | + 'synch_id': None}], |
3911 | + 'job': self.job_data_clone_info, |
3912 | + 'meta_host_counts': {}}), |
3913 | ('create_job', self.job_data_cloned, True, 43)], |
3914 | out_words_ok=['Created job', '43']) |
3915 | |
3916 | def test_clone_reuse_hosts(self): |
3917 | - self.job_data_cloned['hosts'] = [u'host0', 'host1'] |
3918 | + self.job_data_cloned['hosts'] = ['host0', 'host1'] |
3919 | self.run_cmd(argv=['atest', 'job', 'clone', '--id', '42', |
3920 | '-r', 'cloned'], |
3921 | rpcs=[('get_info_for_clone', {'id': '42', |
3922 | 'preserve_metahosts': True}, |
3923 | True, |
3924 | - {u'atomic_group_name': None, |
3925 | - u'hosts': self.local_hosts, |
3926 | - u'job': self.job_data_clone_info, |
3927 | - u'meta_host_counts': {}}), |
3928 | + {'atomic_group_name': None, |
3929 | + 'hosts': self.local_hosts, |
3930 | + 'job': self.job_data_clone_info, |
3931 | + 'meta_host_counts': {}}), |
3932 | ('create_job', self.job_data_cloned, True, 43)], |
3933 | out_words_ok=['Created job', '43']) |
3934 | |
3935 | @@ -1475,27 +1475,27 @@ class job_clone_unittest(cli_mock.cli_unittest): |
3936 | rpcs=[('get_info_for_clone', {'id': '42', |
3937 | 'preserve_metahosts': True}, |
3938 | True, |
3939 | - {u'atomic_group_name': None, |
3940 | - u'hosts': [], |
3941 | - u'job': self.job_data_clone_info, |
3942 | - u'meta_host_counts': {u'type0': 1, |
3943 | - u'type1': 4}}), |
3944 | + {'atomic_group_name': None, |
3945 | + 'hosts': [], |
3946 | + 'job': self.job_data_clone_info, |
3947 | + 'meta_host_counts': {'type0': 1, |
3948 | + 'type1': 4}}), |
3949 | ('create_job', self.job_data_cloned, True, 43)], |
3950 | out_words_ok=['Created job', '43']) |
3951 | |
3952 | def test_clone_reuse_both(self): |
3953 | - self.job_data_cloned['hosts'] = [u'host0', 'host1'] |
3954 | + self.job_data_cloned['hosts'] = ['host0', 'host1'] |
3955 | self.job_data_cloned['meta_hosts'] = ['type1'] * 4 + ['type0'] |
3956 | self.run_cmd(argv=['atest', 'job', 'clone', '--id', '42', |
3957 | '-r', 'cloned'], |
3958 | rpcs=[('get_info_for_clone', {'id': '42', |
3959 | 'preserve_metahosts': True}, |
3960 | True, |
3961 | - {u'atomic_group_name': None, |
3962 | - u'hosts': self.local_hosts, |
3963 | - u'job': self.job_data_clone_info, |
3964 | - u'meta_host_counts': {u'type0': 1, |
3965 | - u'type1': 4}}), |
3966 | + {'atomic_group_name': None, |
3967 | + 'hosts': self.local_hosts, |
3968 | + 'job': self.job_data_clone_info, |
3969 | + 'meta_host_counts': {'type0': 1, |
3970 | + 'type1': 4}}), |
3971 | ('create_job', self.job_data_cloned, True, 43)], |
3972 | out_words_ok=['Created job', '43']) |
3973 | |
3974 | @@ -1513,41 +1513,41 @@ class job_clone_unittest(cli_mock.cli_unittest): |
3975 | err_words_ok=['specify']) |
3976 | |
3977 | def test_clone_new_multiple_hosts(self): |
3978 | - self.job_data_cloned['hosts'] = [u'host5', 'host4', 'host3'] |
3979 | + self.job_data_cloned['hosts'] = ['host5', 'host4', 'host3'] |
3980 | self.run_cmd(argv=['atest', 'job', 'clone', '--id', '42', |
3981 | '-m', 'host5,host4,host3', 'cloned'], |
3982 | rpcs=[('get_info_for_clone', {'id': '42', |
3983 | 'preserve_metahosts': False}, |
3984 | True, |
3985 | - {u'atomic_group_name': None, |
3986 | - u'hosts': self.local_hosts, |
3987 | - u'job': self.job_data_clone_info, |
3988 | - u'meta_host_counts': {}}), |
3989 | + {'atomic_group_name': None, |
3990 | + 'hosts': self.local_hosts, |
3991 | + 'job': self.job_data_clone_info, |
3992 | + 'meta_host_counts': {}}), |
3993 | ('create_job', self.job_data_cloned, True, 43)], |
3994 | out_words_ok=['Created job', '43']) |
3995 | |
3996 | def test_clone_oth(self): |
3997 | self.job_data_cloned['hosts'] = [] |
3998 | - self.job_data_cloned['one_time_hosts'] = [u'host5'] |
3999 | + self.job_data_cloned['one_time_hosts'] = ['host5'] |
4000 | self.run_cmd(argv=['atest', 'job', 'clone', '--id', '42', |
4001 | '--one-time-hosts', 'host5', 'cloned'], |
4002 | rpcs=[('get_info_for_clone', {'id': '42', |
4003 | 'preserve_metahosts': False}, |
4004 | True, |
4005 | - {u'atomic_group_name': None, |
4006 | - u'hosts': self.local_hosts, |
4007 | - u'job': self.job_data_clone_info, |
4008 | - u'meta_host_counts': {}}), |
4009 | + {'atomic_group_name': None, |
4010 | + 'hosts': self.local_hosts, |
4011 | + 'job': self.job_data_clone_info, |
4012 | + 'meta_host_counts': {}}), |
4013 | ('create_job', self.job_data_cloned, True, 43)], |
4014 | out_words_ok=['Created job', '43']) |
4015 | |
4016 | |
4017 | class job_abort_unittest(cli_mock.cli_unittest): |
4018 | - results = [{u'status_counts': {u'Aborted': 1}, u'control_file': |
4019 | - u"job.run_test('sleeptest')\n", u'name': u'test_job0', |
4020 | - u'control_type': u'Server', u'priority': |
4021 | - u'Medium', u'owner': u'user0', u'created_on': |
4022 | - u'2008-07-08 17:45:44', u'synch_count': 2, u'id': 180}] |
4023 | + results = [{'status_counts': {'Aborted': 1}, 'control_file': |
4024 | + "job.run_test('sleeptest')\n", 'name': 'test_job0', |
4025 | + 'control_type': 'Server', 'priority': |
4026 | + 'Medium', 'owner': 'user0', 'created_on': |
4027 | + '2008-07-08 17:45:44', 'synch_count': 2, 'id': 180}] |
4028 | |
4029 | def test_execute_job_abort(self): |
4030 | self.run_cmd(argv=['atest', 'job', 'abort', '180', |
4031 | diff --git a/cli/label_unittest.py b/cli/label_unittest.py |
4032 | index b24c9a3..fc079f1 100755 |
4033 | --- a/cli/label_unittest.py |
4034 | +++ b/cli/label_unittest.py |
4035 | @@ -1,4 +1,4 @@ |
4036 | -#!/usr/bin/python2 |
4037 | +#!/usr/bin/python3 |
4038 | # |
4039 | # Copyright 2008 Google Inc. All Rights Reserved. |
4040 | |
4041 | @@ -11,41 +11,41 @@ import os |
4042 | try: |
4043 | import autotest.common as common |
4044 | except ImportError: |
4045 | - import common |
4046 | + from . import common |
4047 | from autotest.cli import cli_mock, topic_common |
4048 | |
4049 | |
4050 | class label_list_unittest(cli_mock.cli_unittest): |
4051 | - values = [{u'id': 180, # Valid label |
4052 | - u'platform': False, |
4053 | - u'name': u'label0', |
4054 | - u'invalid': False, |
4055 | - u'kernel_config': u'', |
4056 | - u'only_if_needed': False}, |
4057 | - {u'id': 338, # Valid label |
4058 | - u'platform': False, |
4059 | - u'name': u'label1', |
4060 | - u'invalid': False, |
4061 | - u'kernel_config': u'', |
4062 | - u'only_if_needed': False}, |
4063 | - {u'id': 340, # Invalid label |
4064 | - u'platform': False, |
4065 | - u'name': u'label2', |
4066 | - u'invalid': True, |
4067 | - u'kernel_config': u'', |
4068 | - u'only_if_needed': False}, |
4069 | - {u'id': 350, # Valid platform |
4070 | - u'platform': True, |
4071 | - u'name': u'plat0', |
4072 | - u'invalid': False, |
4073 | - u'kernel_config': u'', |
4074 | - u'only_if_needed': False}, |
4075 | - {u'id': 420, # Invalid platform |
4076 | - u'platform': True, |
4077 | - u'name': u'plat1', |
4078 | - u'invalid': True, |
4079 | - u'kernel_config': u'', |
4080 | - u'only_if_needed': False}] |
4081 | + values = [{'id': 180, # Valid label |
4082 | + 'platform': False, |
4083 | + 'name': 'label0', |
4084 | + 'invalid': False, |
4085 | + 'kernel_config': '', |
4086 | + 'only_if_needed': False}, |
4087 | + {'id': 338, # Valid label |
4088 | + 'platform': False, |
4089 | + 'name': 'label1', |
4090 | + 'invalid': False, |
4091 | + 'kernel_config': '', |
4092 | + 'only_if_needed': False}, |
4093 | + {'id': 340, # Invalid label |
4094 | + 'platform': False, |
4095 | + 'name': 'label2', |
4096 | + 'invalid': True, |
4097 | + 'kernel_config': '', |
4098 | + 'only_if_needed': False}, |
4099 | + {'id': 350, # Valid platform |
4100 | + 'platform': True, |
4101 | + 'name': 'plat0', |
4102 | + 'invalid': False, |
4103 | + 'kernel_config': '', |
4104 | + 'only_if_needed': False}, |
4105 | + {'id': 420, # Invalid platform |
4106 | + 'platform': True, |
4107 | + 'name': 'plat1', |
4108 | + 'invalid': True, |
4109 | + 'kernel_config': '', |
4110 | + 'only_if_needed': False}] |
4111 | |
4112 | def test_label_list_labels_only(self): |
4113 | self.run_cmd(argv=['atest', 'label', 'list', '--ignore_site_file'], |
4114 | diff --git a/cli/rpc.py b/cli/rpc.py |
4115 | index affb768..f843d86 100644 |
4116 | --- a/cli/rpc.py |
4117 | +++ b/cli/rpc.py |
4118 | @@ -41,7 +41,7 @@ class rpc_comm(object): |
4119 | self.web_server = get_autotest_server(web_server) |
4120 | try: |
4121 | self.proxy = self._connect(rpc_path) |
4122 | - except rpc_client_lib.AuthError, s: |
4123 | + except rpc_client_lib.AuthError as s: |
4124 | raise AuthError(s) |
4125 | |
4126 | def _connect(self, rpc_path): |
4127 | @@ -54,11 +54,11 @@ class rpc_comm(object): |
4128 | |
4129 | def run(self, op, *args, **data): |
4130 | if 'AUTOTEST_CLI_DEBUG' in os.environ: |
4131 | - print self.web_server, op, args, data |
4132 | + print(self.web_server, op, args, data) |
4133 | function = getattr(self.proxy, op) |
4134 | result = function(*args, **data) |
4135 | if 'AUTOTEST_CLI_DEBUG' in os.environ: |
4136 | - print 'result:', result |
4137 | + print('result:', result) |
4138 | return result |
4139 | |
4140 | |
4141 | diff --git a/cli/rpc_unittest.py b/cli/rpc_unittest.py |
4142 | index 2b4ee5a..2e7fe99 100755 |
4143 | --- a/cli/rpc_unittest.py |
4144 | +++ b/cli/rpc_unittest.py |
4145 | @@ -1,4 +1,4 @@ |
4146 | -#!/usr/bin/python2 |
4147 | +#!/usr/bin/python3 |
4148 | # |
4149 | # Copyright 2008 Google Inc. All Rights Reserved. |
4150 | |
4151 | @@ -9,7 +9,7 @@ import os |
4152 | try: |
4153 | import autotest.common as common |
4154 | except ImportError: |
4155 | - import common |
4156 | + from . import common |
4157 | from autotest.cli import rpc |
4158 | from autotest.client.shared.settings import settings |
4159 | |
4160 | diff --git a/cli/setup.py b/cli/setup.py |
4161 | index d28b420..3ae8fba 100644 |
4162 | --- a/cli/setup.py |
4163 | +++ b/cli/setup.py |
4164 | @@ -5,7 +5,7 @@ import os |
4165 | try: |
4166 | import autotest.common as common |
4167 | except ImportError: |
4168 | - import common |
4169 | + from . import common |
4170 | |
4171 | from autotest.client.shared import version |
4172 | |
4173 | diff --git a/cli/test_unittest.py b/cli/test_unittest.py |
4174 | index e6d0392..c3b6da9 100755 |
4175 | --- a/cli/test_unittest.py |
4176 | +++ b/cli/test_unittest.py |
4177 | @@ -1,4 +1,4 @@ |
4178 | -#!/usr/bin/python2 |
4179 | +#!/usr/bin/python3 |
4180 | # |
4181 | # Copyright 2008 Google Inc. All Rights Reserved. |
4182 | |
4183 | @@ -11,51 +11,51 @@ import os |
4184 | try: |
4185 | import autotest.common as common |
4186 | except ImportError: |
4187 | - import common |
4188 | + from . import common |
4189 | from autotest.cli import cli_mock, topic_common, test |
4190 | |
4191 | |
4192 | class test_list_unittest(cli_mock.cli_unittest): |
4193 | - values = [{u'description': u'unknown', |
4194 | - u'test_type': u'Client', |
4195 | - u'test_class': u'Canned Test Sets', |
4196 | - u'path': u'client/tests/test0/control', |
4197 | - u'synch_type': u'Asynchronous', |
4198 | - u'id': 138, |
4199 | - u'name': u'test0', |
4200 | - u'experimental': False}, |
4201 | - {u'description': u'unknown', |
4202 | - u'test_type': u'Server', |
4203 | - u'test_class': u'Kernel', |
4204 | - u'path': u'server/tests/test1/control', |
4205 | - u'synch_type': u'Asynchronous', |
4206 | - u'id': 139, |
4207 | - u'name': u'test1', |
4208 | - u'experimental': False}, |
4209 | - {u'description': u'unknown', |
4210 | - u'test_type': u'Client', |
4211 | - u'test_class': u'Canned Test Sets', |
4212 | - u'path': u'client/tests/test2/control.readprofile', |
4213 | - u'synch_type': u'Asynchronous', |
4214 | - u'id': 140, |
4215 | - u'name': u'test2', |
4216 | - u'experimental': False}, |
4217 | - {u'description': u'unknown', |
4218 | - u'test_type': u'Server', |
4219 | - u'test_class': u'Canned Test Sets', |
4220 | - u'path': u'server/tests/test3/control', |
4221 | - u'synch_type': u'Asynchronous', |
4222 | - u'id': 142, |
4223 | - u'name': u'test3', |
4224 | - u'experimental': False}, |
4225 | - {u'description': u'Random stuff to check that things are ok', |
4226 | - u'test_type': u'Client', |
4227 | - u'test_class': u'Hardware', |
4228 | - u'path': u'client/tests/test4/control.export', |
4229 | - u'synch_type': u'Asynchronous', |
4230 | - u'id': 143, |
4231 | - u'name': u'test4', |
4232 | - u'experimental': True}] |
4233 | + values = [{'description': 'unknown', |
4234 | + 'test_type': 'Client', |
4235 | + 'test_class': 'Canned Test Sets', |
4236 | + 'path': 'client/tests/test0/control', |
4237 | + 'synch_type': 'Asynchronous', |
4238 | + 'id': 138, |
4239 | + 'name': 'test0', |
4240 | + 'experimental': False}, |
4241 | + {'description': 'unknown', |
4242 | + 'test_type': 'Server', |
4243 | + 'test_class': 'Kernel', |
4244 | + 'path': 'server/tests/test1/control', |
4245 | + 'synch_type': 'Asynchronous', |
4246 | + 'id': 139, |
4247 | + 'name': 'test1', |
4248 | + 'experimental': False}, |
4249 | + {'description': 'unknown', |
4250 | + 'test_type': 'Client', |
4251 | + 'test_class': 'Canned Test Sets', |
4252 | + 'path': 'client/tests/test2/control.readprofile', |
4253 | + 'synch_type': 'Asynchronous', |
4254 | + 'id': 140, |
4255 | + 'name': 'test2', |
4256 | + 'experimental': False}, |
4257 | + {'description': 'unknown', |
4258 | + 'test_type': 'Server', |
4259 | + 'test_class': 'Canned Test Sets', |
4260 | + 'path': 'server/tests/test3/control', |
4261 | + 'synch_type': 'Asynchronous', |
4262 | + 'id': 142, |
4263 | + 'name': 'test3', |
4264 | + 'experimental': False}, |
4265 | + {'description': 'Random stuff to check that things are ok', |
4266 | + 'test_type': 'Client', |
4267 | + 'test_class': 'Hardware', |
4268 | + 'path': 'client/tests/test4/control.export', |
4269 | + 'synch_type': 'Asynchronous', |
4270 | + 'id': 143, |
4271 | + 'name': 'test4', |
4272 | + 'experimental': True}] |
4273 | |
4274 | def test_test_list_tests_default(self): |
4275 | self.run_cmd(argv=['atest', 'test', 'list'], |
4276 | @@ -77,14 +77,14 @@ class test_list_unittest(cli_mock.cli_unittest): |
4277 | self.run_cmd(argv=['atest', 'test', 'list', '--experimental'], |
4278 | rpcs=[('get_tests', {'experimental': True}, |
4279 | True, |
4280 | - [{u'description': u'Random stuff', |
4281 | - u'test_type': u'Client', |
4282 | - u'test_class': u'Hardware', |
4283 | - u'path': u'client/tests/test4/control.export', |
4284 | - u'synch_type': u'Asynchronous', |
4285 | - u'id': 143, |
4286 | - u'name': u'test4', |
4287 | - u'experimental': True}])], |
4288 | + [{'description': 'Random stuff', |
4289 | + 'test_type': 'Client', |
4290 | + 'test_class': 'Hardware', |
4291 | + 'path': 'client/tests/test4/control.export', |
4292 | + 'synch_type': 'Asynchronous', |
4293 | + 'id': 143, |
4294 | + 'name': 'test4', |
4295 | + 'experimental': True}])], |
4296 | out_words_ok=['test4'], |
4297 | out_words_no=['Random', 'control.export']) |
4298 | |
4299 | diff --git a/cli/threads.py b/cli/threads.py |
4300 | index 47fb295..374c052 100644 |
4301 | --- a/cli/threads.py |
4302 | +++ b/cli/threads.py |
4303 | @@ -3,7 +3,7 @@ |
4304 | # Released under the GPLv2 |
4305 | |
4306 | import threading |
4307 | -import Queue |
4308 | +import queue |
4309 | |
4310 | |
4311 | class ThreadPool: |
4312 | @@ -15,16 +15,16 @@ class ThreadPool: |
4313 | |
4314 | def __init__(self, function, numthreads=40): |
4315 | assert(numthreads > 0) |
4316 | - self.threads = Queue.Queue(0) |
4317 | + self.threads = queue.Queue(0) |
4318 | self.function = function |
4319 | self.numthreads = 0 |
4320 | - self.queue = Queue.Queue(0) |
4321 | + self.queue = queue.Queue(0) |
4322 | self._start_threads(numthreads) |
4323 | |
4324 | def wait(self): |
4325 | """ Checks to see if any threads are still working and |
4326 | blocks until worker threads all complete. """ |
4327 | - for x in xrange(self.numthreads): |
4328 | + for x in range(self.numthreads): |
4329 | self.queue.put('die') |
4330 | # As only spawned threads are allowed to add new ones, |
4331 | # we can safely wait for the thread queue to be empty |
4332 | @@ -37,7 +37,7 @@ class ThreadPool: |
4333 | if thread.isAlive(): |
4334 | thread.join() |
4335 | dead += 1 |
4336 | - except Queue.Empty: |
4337 | + except queue.Empty: |
4338 | assert(dead == self.numthreads) |
4339 | return |
4340 | |
4341 | @@ -55,7 +55,7 @@ class ThreadPool: |
4342 | def _start_threads(self, nthreads): |
4343 | """ Start up threads to spawn workers. """ |
4344 | self.numthreads += nthreads |
4345 | - for i in xrange(nthreads): |
4346 | + for i in range(nthreads): |
4347 | thread = threading.Thread(target=self._new_worker) |
4348 | thread.setDaemon(True) |
4349 | self.threads.put(thread) |
4350 | @@ -70,7 +70,7 @@ class ThreadPool: |
4351 | return |
4352 | try: |
4353 | self.function(data) |
4354 | - except Exception, full_error: |
4355 | + except Exception as full_error: |
4356 | # Put a catch all here. |
4357 | - print ('Unexpected failure in the thread calling %s: %s' % |
4358 | - (self.function.__name__, full_error)) |
4359 | + print(('Unexpected failure in the thread calling %s: %s' % |
4360 | + (self.function.__name__, full_error))) |
4361 | diff --git a/cli/threads_unittest.py b/cli/threads_unittest.py |
4362 | index a692a22..e1336ca 100755 |
4363 | --- a/cli/threads_unittest.py |
4364 | +++ b/cli/threads_unittest.py |
4365 | @@ -1,4 +1,4 @@ |
4366 | -#!/usr/bin/python2 |
4367 | +#!/usr/bin/python3 |
4368 | # |
4369 | # Copyright 2008 Google Inc. All Rights Reserved. |
4370 | |
4371 | @@ -9,17 +9,17 @@ import sys |
4372 | import os |
4373 | |
4374 | import threading |
4375 | -import Queue |
4376 | +import queue |
4377 | |
4378 | try: |
4379 | import autotest.common as common |
4380 | except ImportError: |
4381 | - import common |
4382 | + from . import common |
4383 | from autotest.cli import cli_mock, threads |
4384 | |
4385 | |
4386 | class thread_unittest(cli_mock.cli_unittest): |
4387 | - results = Queue.Queue() |
4388 | + results = queue.Queue() |
4389 | |
4390 | def _workload(self, i): |
4391 | self.results.put(i * i) |
4392 | @@ -36,7 +36,7 @@ class thread_unittest(cli_mock.cli_unittest): |
4393 | |
4394 | def test_one_thread(self): |
4395 | th = threads.ThreadPool(self._workload, numthreads=1) |
4396 | - th.queue_work(range(10)) |
4397 | + th.queue_work(list(range(10))) |
4398 | th.wait() |
4399 | res = [] |
4400 | while not self.results.empty(): |
4401 | @@ -45,12 +45,12 @@ class thread_unittest(cli_mock.cli_unittest): |
4402 | |
4403 | def _threading(self, numthreads, count): |
4404 | th = threads.ThreadPool(self._workload, numthreads=numthreads) |
4405 | - th.queue_work(range(count)) |
4406 | + th.queue_work(list(range(count))) |
4407 | th.wait() |
4408 | res = [] |
4409 | while not self.results.empty(): |
4410 | res.append(self.results.get()) |
4411 | - self.assertEqualNoOrder([i * i for i in xrange(count)], res) |
4412 | + self.assertEqualNoOrder([i * i for i in range(count)], res) |
4413 | |
4414 | def test_threading(self): |
4415 | self._threading(10, 10) |
4416 | @@ -60,13 +60,13 @@ class thread_unittest(cli_mock.cli_unittest): |
4417 | |
4418 | def test_threading_multi_queueing(self): |
4419 | th = threads.ThreadPool(self._workload, numthreads=5) |
4420 | - th.queue_work(range(5)) |
4421 | - th.queue_work(range(5, 10)) |
4422 | + th.queue_work(list(range(5))) |
4423 | + th.queue_work(list(range(5, 10))) |
4424 | th.wait() |
4425 | res = [] |
4426 | while not self.results.empty(): |
4427 | res.append(self.results.get()) |
4428 | - self.assertEqualNoOrder([i * i for i in xrange(10)], res) |
4429 | + self.assertEqualNoOrder([i * i for i in range(10)], res) |
4430 | |
4431 | |
4432 | if __name__ == '__main__': |
4433 | diff --git a/cli/topic_common.py b/cli/topic_common.py |
4434 | index 1128113..e6ed019 100644 |
4435 | --- a/cli/topic_common.py |
4436 | +++ b/cli/topic_common.py |
4437 | @@ -61,7 +61,7 @@ import re |
4438 | import sys |
4439 | import textwrap |
4440 | import traceback |
4441 | -import urllib2 |
4442 | +import urllib.request, urllib.error, urllib.parse |
4443 | from autotest.cli import rpc |
4444 | from autotest.client.shared.test_utils import mock |
4445 | |
4446 | @@ -150,7 +150,7 @@ def _get_item_key(item, key): |
4447 | raise ValueError('empty subkey in %r' % key) |
4448 | try: |
4449 | nested_item = nested_item[subkey] |
4450 | - except KeyError, e: |
4451 | + except KeyError as e: |
4452 | raise KeyError('%r - looking up key %r in %r' % |
4453 | (e, key, nested_item)) |
4454 | else: |
4455 | @@ -266,18 +266,18 @@ class atest(object): |
4456 | self.failure(rest, item="", what_failed=msg) |
4457 | |
4458 | def invalid_syntax(self, msg): |
4459 | |
4460 | - print >> sys.stderr, msg |
4461 | |
4462 | - print "usage:", |
4463 | - print self._get_usage() |
4464 | |
4465 | + print() |
4466 | + print(msg, file=sys.stderr) |
4467 | + print() |
4468 | + print("usage:", end=' ') |
4469 | + print(self._get_usage()) |
4470 | + print() |
4471 | sys.exit(1) |
4472 | |
4473 | def generic_error(self, msg): |
4474 | if self.debug: |
4475 | traceback.print_exc() |
4476 | - print >> sys.stderr, msg |
4477 | + print(msg, file=sys.stderr) |
4478 | sys.exit(1) |
4479 | |
4480 | def parse_json_exception(self, full_error): |
4481 | @@ -305,7 +305,7 @@ class atest(object): |
4482 | errmsg = str(full_error).split('Traceback')[0].rstrip('\n') |
4483 | |
4484 | if self.kill_on_failure or fatal: |
4485 | - print >> sys.stderr, "%s\n %s" % (what_failed, errmsg) |
4486 | + print("%s\n %s" % (what_failed, errmsg), file=sys.stderr) |
4487 | sys.exit(1) |
4488 | |
4489 | # Build a dictionary with the 'what_failed' as keys. The |
4490 | @@ -318,7 +318,7 @@ class atest(object): |
4491 | # even if they contain the 'item' |
4492 | if item and item in errmsg: |
4493 | errmsg = errmsg.replace(item, FAIL_TAG) |
4494 | - if self.failed.has_key(what_failed): |
4495 | + if what_failed in self.failed: |
4496 | self.failed[what_failed].setdefault(errmsg, set()).add(item) |
4497 | else: |
4498 | self.failed[what_failed] = {errmsg: set([item])} |
4499 | @@ -326,27 +326,27 @@ class atest(object): |
4500 | def show_all_failures(self): |
4501 | if not self.failed: |
4502 | return 0 |
4503 | - for what_failed in self.failed.keys(): |
4504 | - print >> sys.stderr, what_failed + ':' |
4505 | - for (errmsg, items) in self.failed[what_failed].iteritems(): |
4506 | + for what_failed in list(self.failed.keys()): |
4507 | + print(what_failed + ':', file=sys.stderr) |
4508 | + for (errmsg, items) in self.failed[what_failed].items(): |
4509 | if len(items) == 0: |
4510 | - print >> sys.stderr, errmsg |
4511 | + print(errmsg, file=sys.stderr) |
4512 | elif items == set(['']): |
4513 | - print >> sys.stderr, ' ' + errmsg |
4514 | + print(' ' + errmsg, file=sys.stderr) |
4515 | elif len(items) == 1: |
4516 | # Restore the only item |
4517 | if FAIL_TAG in errmsg: |
4518 | errmsg = errmsg.replace(FAIL_TAG, items.pop()) |
4519 | else: |
4520 | errmsg = '%s (%s)' % (errmsg, items.pop()) |
4521 | - print >> sys.stderr, ' ' + errmsg |
4522 | + print(' ' + errmsg, file=sys.stderr) |
4523 | else: |
4524 | - print >> sys.stderr, ' ' + errmsg + ' with <XYZ> in:' |
4525 | + print(' ' + errmsg + ' with <XYZ> in:', file=sys.stderr) |
4526 | twrap = textwrap.TextWrapper(initial_indent=' ', |
4527 | subsequent_indent=' ') |
4528 | items = list(items) |
4529 | items.sort() |
4530 | - print >> sys.stderr, twrap.fill(', '.join(items)) |
4531 | + print(twrap.fill(', '.join(items)), file=sys.stderr) |
4532 | return 1 |
4533 | |
4534 | def __init__(self): |
4535 | @@ -416,7 +416,7 @@ class atest(object): |
4536 | values, leftover = item_parse_info.get_values(options, |
4537 | leftover) |
4538 | setattr(self, item_parse_info.attribute_name, values) |
4539 | - except CliError, s: |
4540 | + except CliError as s: |
4541 | self.invalid_syntax(s) |
4542 | |
4543 | if (req_items and not getattr(self, req_items, None)): |
4544 | @@ -457,7 +457,7 @@ class atest(object): |
4545 | self.username = options.username |
4546 | try: |
4547 | self.afe = rpc.afe_comm(self.web_server, username=self.username) |
4548 | - except rpc.AuthError, s: |
4549 | + except rpc.AuthError as s: |
4550 | self.failure(str(s), fatal=True) |
4551 | |
4552 | return (options, leftover) |
4553 | @@ -480,7 +480,7 @@ class atest(object): |
4554 | while retry: |
4555 | try: |
4556 | return self.afe.run(op, **data) |
4557 | - except urllib2.URLError, err: |
4558 | + except urllib.error.URLError as err: |
4559 | if hasattr(err, 'reason'): |
4560 | if 'timed out' not in err.reason: |
4561 | self.invalid_syntax('Invalid server name %s: %s' % |
4562 | @@ -493,7 +493,7 @@ class atest(object): |
4563 | what_failed=("Error received from web server")) |
4564 | raise CliError("Error from web server") |
4565 | if self.debug: |
4566 | - print 'retrying: %r %d' % (data, retry) |
4567 | + print('retrying: %r %d' % (data, retry)) |
4568 | retry -= 1 |
4569 | if retry == 0: |
4570 | if item: |
4571 | @@ -506,7 +506,7 @@ class atest(object): |
4572 | raise CliError("Timed-out contacting the Autotest server") |
4573 | except mock.CheckPlaybackError: |
4574 | raise |
4575 | - except Exception, full_error: |
4576 | + except Exception as full_error: |
4577 | # There are various exceptions throwns by JSON, |
4578 | # urllib & httplib, so catch them all. |
4579 | self.failure(full_error, item=item, |
4580 | @@ -520,22 +520,22 @@ class atest(object): |
4581 | if len(values) == 0: |
4582 | return |
4583 | elif len(values) == 1: |
4584 | - print msg + ': ' |
4585 | + print(msg + ': ') |
4586 | elif len(values) > 1: |
4587 | if msg.endswith('s'): |
4588 | - print msg + ': ' |
4589 | + print(msg + ': ') |
4590 | else: |
4591 | - print msg + 's: ' |
4592 | + print(msg + 's: ') |
4593 | |
4594 | values.sort() |
4595 | |
4596 | if 'AUTOTEST_CLI_NO_WRAP' in os.environ: |
4597 | - print '\n'.join(values) |
4598 | + print('\n'.join(values)) |
4599 | return |
4600 | |
4601 | twrap = textwrap.TextWrapper(initial_indent='\t', |
4602 | subsequent_indent='\t') |
4603 | - print twrap.fill(', '.join(values)) |
4604 | + print(twrap.fill(', '.join(values))) |
4605 | |
4606 | def __conv_value(self, type, value): |
4607 | return KEYS_CONVERT.get(type, str)(value) |
4608 | @@ -545,12 +545,12 @@ class atest(object): |
4609 | if not items: |
4610 | return |
4611 | if title: |
4612 | - print title |
4613 | + print(title) |
4614 | for item in items: |
4615 | for key in keys: |
4616 | - print '%s: %s' % (KEYS_TO_NAMES_EN[key], |
4617 | + print('%s: %s' % (KEYS_TO_NAMES_EN[key], |
4618 | self.__conv_value(key, |
4619 | - _get_item_key(item, key))) |
4620 | + _get_item_key(item, key)))) |
4621 | |
4622 | def print_fields_parse(self, items, keys, title=None): |
4623 | """Print the keys in each item as comma |
4624 | @@ -562,7 +562,7 @@ class atest(object): |
4625 | for key in keys |
4626 | if self.__conv_value(key, |
4627 | _get_item_key(item, key)) != ''] |
4628 | - print self.parse_delim.join(values) |
4629 | + print(self.parse_delim.join(values)) |
4630 | |
4631 | def __find_justified_fmt(self, items, keys): |
4632 | """Find the max length for each field.""" |
4633 | @@ -571,7 +571,7 @@ class atest(object): |
4634 | # lines when the max is overlaps but the current values |
4635 | # are smaller |
4636 | if not items: |
4637 | - print "No results" |
4638 | + print("No results") |
4639 | return |
4640 | for key in keys[:-1]: |
4641 | lens[key] = max(len(self.__conv_value(key, |
4642 | @@ -590,17 +590,17 @@ class atest(object): |
4643 | return |
4644 | fmt = self.__find_justified_fmt(items, keys_header) |
4645 | header = tuple(KEYS_TO_NAMES_EN[key] for key in keys_header) |
4646 | - print fmt % header |
4647 | + print(fmt % header) |
4648 | for item in items: |
4649 | values = tuple(self.__conv_value(key, |
4650 | _get_item_key(item, key)) |
4651 | for key in keys_header) |
4652 | - print fmt % values |
4653 | + print(fmt % values) |
4654 | if sublist_keys: |
4655 | for key in sublist_keys: |
4656 | self.print_wrapped(KEYS_TO_NAMES_EN[key], |
4657 | _get_item_key(item, key)) |
4658 | - print '\n' |
4659 | + print('\n') |
4660 | |
4661 | def print_table_parse(self, items, keys_header, sublist_keys=()): |
4662 | """Print a mix of header and lists in a user readable |
4663 | @@ -618,16 +618,16 @@ class atest(object): |
4664 | for key in sublist_keys |
4665 | if len(_get_item_key(item, key))] |
4666 | |
4667 | - print self.parse_delim.join(values) |
4668 | + print(self.parse_delim.join(values)) |
4669 | |
4670 | def print_by_ids_std(self, items, title=None, line_before=False): |
4671 | """Prints ID & names of items in a user readable form""" |
4672 | if not items: |
4673 | return |
4674 | if line_before: |
4675 | |
4676 | + print() |
4677 | if title: |
4678 | - print title + ':' |
4679 | + print(title + ':') |
4680 | self.print_table_std(items, keys_header=['id', 'name']) |
4681 | |
4682 | def print_by_ids_parse(self, items, title=None, line_before=False): |
4683 | @@ -635,7 +635,7 @@ class atest(object): |
4684 | if not items: |
4685 | return |
4686 | if title: |
4687 | - print title + '=', |
4688 | + print(title + '=', end=' ') |
4689 | values = [] |
4690 | for item in items: |
4691 | values += ['%s=%s' % (KEYS_TO_NAMES_EN[key], |
4692 | @@ -644,17 +644,17 @@ class atest(object): |
4693 | for key in ['id', 'name'] |
4694 | if self.__conv_value(key, |
4695 | _get_item_key(item, key)) != ''] |
4696 | - print self.parse_delim.join(values) |
4697 | + print(self.parse_delim.join(values)) |
4698 | |
4699 | def print_list_std(self, items, key): |
4700 | """Print a wrapped list of results""" |
4701 | if not items: |
4702 | return |
4703 | - print ' '.join(_get_item_key(item, key) for item in items) |
4704 | + print(' '.join(_get_item_key(item, key) for item in items)) |
4705 | |
4706 | def print_list_parse(self, items, key): |
4707 | """Print a wrapped list of results""" |
4708 | if not items: |
4709 | return |
4710 | - print '%s=%s' % (KEYS_TO_NAMES_EN[key], |
4711 | - ','.join(_get_item_key(item, key) for item in items)) |
4712 | + print('%s=%s' % (KEYS_TO_NAMES_EN[key], |
4713 | + ','.join(_get_item_key(item, key) for item in items))) |
4714 | diff --git a/cli/topic_common_unittest.py b/cli/topic_common_unittest.py |
4715 | index 3d1a57d..43a0384 100755 |
4716 | --- a/cli/topic_common_unittest.py |
4717 | +++ b/cli/topic_common_unittest.py |
4718 | @@ -1,4 +1,4 @@ |
4719 | -#!/usr/bin/python2 |
4720 | +#!/usr/bin/python3 |
4721 | # |
4722 | # Copyright 2008 Google Inc. All Rights Reserved. |
4723 | |
4724 | @@ -7,13 +7,13 @@ |
4725 | import unittest |
4726 | import os |
4727 | import sys |
4728 | -import StringIO |
4729 | -import urllib2 |
4730 | +import io |
4731 | +import urllib.request, urllib.error, urllib.parse |
4732 | |
4733 | try: |
4734 | import autotest.common as common |
4735 | except ImportError: |
4736 | - import common |
4737 | + from . import common |
4738 | from autotest.cli import cli_mock, topic_common, rpc |
4739 | from autotest.frontend.afe.json_rpc import proxy |
4740 | |
4741 | @@ -28,11 +28,11 @@ class topic_common_misc_tests(unittest.TestCase): |
4742 | self.assertRaises(KeyError, get_item_key, {}, 'a.') |
4743 | self.assertRaises(ValueError, get_item_key, {'a': {}}, 'a.') |
4744 | self.assertRaises(KeyError, get_item_key, {'a': {}}, 'a.b') |
4745 | - self.assertEquals(2, get_item_key({'a.b': 2, 'a': {}}, 'a.b')) |
4746 | - self.assertEquals(9, get_item_key({'a': {'b': 9}}, 'a.b')) |
4747 | - self.assertEquals(3, get_item_key({'a': {'b': {'c': 3}}}, 'a.b.c')) |
4748 | - self.assertEquals(5, get_item_key({'a': 5}, 'a')) |
4749 | - self.assertEquals({'b': 9}, get_item_key({'a': {'b': 9}}, 'a')) |
4750 | + self.assertEqual(2, get_item_key({'a.b': 2, 'a': {}}, 'a.b')) |
4751 | + self.assertEqual(9, get_item_key({'a': {'b': 9}}, 'a.b')) |
4752 | + self.assertEqual(3, get_item_key({'a': {'b': {'c': 3}}}, 'a.b.c')) |
4753 | + self.assertEqual(5, get_item_key({'a': 5}, 'a')) |
4754 | + self.assertEqual({'b': 9}, get_item_key({'a': {'b': 9}}, 'a')) |
4755 | |
4756 | |
4757 | class item_parse_info_unittest(cli_mock.cli_unittest): |
4758 | @@ -307,18 +307,18 @@ class atest_unittest(cli_mock.cli_unittest): |
4759 | self.atest.invalid_arg, 'This is bad') |
4760 | (output, err) = self.god.unmock_io() |
4761 | self.god.check_playback() |
4762 | - self.assert_(err.find('This is bad') >= 0) |
4763 | + self.assertTrue(err.find('This is bad') >= 0) |
4764 | |
4765 | def test_invalid_arg_continue(self): |
4766 | # The string will be placed into self.atest.failed |
4767 | self.atest.invalid_arg('This is sort of ok') |
4768 | - self.assert_('This is sort of ok' in self.atest.failed.keys()) |
4769 | + self.assertTrue('This is sort of ok' in list(self.atest.failed.keys())) |
4770 | |
4771 | def test_failure_continue(self): |
4772 | self.atest.failure('This is partly bad', item='item0', |
4773 | what_failed='something important') |
4774 | err = self.atest.failed['something important'] |
4775 | - self.assert_('This is partly bad' in err.keys()) |
4776 | + self.assertTrue('This is partly bad' in list(err.keys())) |
4777 | |
4778 | def test_failure_continue_multiple_different_errors(self): |
4779 | self.atest.failure('This is partly bad', item='item0', |
4780 | @@ -326,11 +326,11 @@ class atest_unittest(cli_mock.cli_unittest): |
4781 | self.atest.failure('This is really bad', item='item0', |
4782 | what_failed='something really important') |
4783 | err = self.atest.failed['something important'] |
4784 | - self.assert_('This is partly bad' in err) |
4785 | - self.assert_('This is really bad' not in err) |
4786 | + self.assertTrue('This is partly bad' in err) |
4787 | + self.assertTrue('This is really bad' not in err) |
4788 | err = self.atest.failed['something really important'] |
4789 | - self.assert_('This is partly bad' not in err) |
4790 | - self.assert_('This is really bad' in err) |
4791 | + self.assertTrue('This is partly bad' not in err) |
4792 | + self.assertTrue('This is really bad' in err) |
4793 | |
4794 | def test_failure_continue_multiple_same_errors(self): |
4795 | self.atest.failure('This is partly bad', item='item0', |
4796 | @@ -338,10 +338,10 @@ class atest_unittest(cli_mock.cli_unittest): |
4797 | self.atest.failure('This is really bad', item='item1', |
4798 | what_failed='something important') |
4799 | errs = self.atest.failed['something important'] |
4800 | - self.assert_('This is partly bad' in errs) |
4801 | - self.assert_('This is really bad' in errs) |
4802 | - self.assert_(set(['item0']) in errs.values()) |
4803 | - self.assert_(set(['item1']) in errs.values()) |
4804 | + self.assertTrue('This is partly bad' in errs) |
4805 | + self.assertTrue('This is really bad' in errs) |
4806 | + self.assertTrue(set(['item0']) in list(errs.values())) |
4807 | + self.assertTrue(set(['item1']) in list(errs.values())) |
4808 | |
4809 | def test_failure_continue_multiple_errors_mixed(self): |
4810 | self.atest.failure('This is partly bad', item='item0', |
4811 | @@ -351,16 +351,16 @@ class atest_unittest(cli_mock.cli_unittest): |
4812 | self.atest.failure('This is really bad', item='item1', |
4813 | what_failed='something important') |
4814 | errs = self.atest.failed['something important'] |
4815 | - self.assert_('This is partly bad' in errs) |
4816 | - self.assert_('This is really bad' in errs) |
4817 | - self.assert_(set(['item0']) in errs.values()) |
4818 | - self.assert_(set(['item1']) in errs.values()) |
4819 | + self.assertTrue('This is partly bad' in errs) |
4820 | + self.assertTrue('This is really bad' in errs) |
4821 | + self.assertTrue(set(['item0']) in list(errs.values())) |
4822 | + self.assertTrue(set(['item1']) in list(errs.values())) |
4823 | |
4824 | errs = self.atest.failed['something really important'] |
4825 | - self.assert_('This is really bad' in errs) |
4826 | - self.assert_('This is partly bad' not in errs) |
4827 | - self.assert_(set(['item0']) in errs.values()) |
4828 | - self.assert_(set(['item1']) not in errs.values()) |
4829 | + self.assertTrue('This is really bad' in errs) |
4830 | + self.assertTrue('This is partly bad' not in errs) |
4831 | + self.assertTrue(set(['item0']) in list(errs.values())) |
4832 | + self.assertTrue(set(['item1']) not in list(errs.values())) |
4833 | |
4834 | def test_failure_continue_multiple_errors_mixed_same_error(self): |
4835 | self.atest.failure('This is partly bad', item='item0', |
4836 | @@ -370,15 +370,15 @@ class atest_unittest(cli_mock.cli_unittest): |
4837 | self.atest.failure('This is partly bad', item='item1', |
4838 | what_failed='something important') |
4839 | errs = self.atest.failed['something important'] |
4840 | - self.assert_('This is partly bad' in errs) |
4841 | - self.assert_('This is really bad' not in errs) |
4842 | - self.assert_(set(['item0', 'item1']) in errs.values()) |
4843 | + self.assertTrue('This is partly bad' in errs) |
4844 | + self.assertTrue('This is really bad' not in errs) |
4845 | + self.assertTrue(set(['item0', 'item1']) in list(errs.values())) |
4846 | |
4847 | errs = self.atest.failed['something really important'] |
4848 | - self.assert_('This is really bad' in errs) |
4849 | - self.assert_('This is partly bad' not in errs) |
4850 | - self.assert_(set(['item0']) in errs.values()) |
4851 | - self.assert_(set(['item1']) not in errs.values()) |
4852 | + self.assertTrue('This is really bad' in errs) |
4853 | + self.assertTrue('This is partly bad' not in errs) |
4854 | + self.assertTrue(set(['item0']) in list(errs.values())) |
4855 | + self.assertTrue(set(['item1']) not in list(errs.values())) |
4856 | |
4857 | def test_failure_exit(self): |
4858 | self.atest.kill_on_failure = True |
4859 | @@ -388,7 +388,7 @@ class atest_unittest(cli_mock.cli_unittest): |
4860 | self.atest.failure, 'This is partly bad') |
4861 | (output, err) = self.god.unmock_io() |
4862 | self.god.check_playback() |
4863 | - self.assert_(err.find('This is partly bad') >= 0) |
4864 | + self.assertTrue(err.find('This is partly bad') >= 0) |
4865 | |
4866 | def test_failure_exit_item(self): |
4867 | self.atest.kill_on_failure = True |
4868 | @@ -731,28 +731,28 @@ class atest_unittest(cli_mock.cli_unittest): |
4869 | def test_execute_rpc_bad_server(self): |
4870 | self.atest.afe = rpc.afe_comm('http://does_not_exist') |
4871 | self.god.mock_io() |
4872 | - rpc.afe_comm.run.expect_call('myop').and_raises(urllib2.URLError("<urlopen error (-2, 'Name or service not known')>")) |
4873 | + rpc.afe_comm.run.expect_call('myop').and_raises(urllib.error.URLError("<urlopen error (-2, 'Name or service not known')>")) |
4874 | sys.exit.expect_call(1).and_raises(cli_mock.ExitException) |
4875 | self.assertRaises(cli_mock.ExitException, |
4876 | self.atest.execute_rpc, 'myop') |
4877 | (output, err) = self.god.unmock_io() |
4878 | self.god.check_playback() |
4879 | - self.assert_(err.find('http://does_not_exist') >= 0) |
4880 | + self.assertTrue(err.find('http://does_not_exist') >= 0) |
4881 | |
4882 | # |
4883 | # Print Unit tests |
4884 | # |
4885 | def __test_print_fields(self, func, expected, **dargs): |
4886 | - if not dargs.has_key('items'): |
4887 | + if 'items' not in dargs: |
4888 | dargs['items'] = [{'hostname': 'h0', |
4889 | 'platform': 'p0', |
4890 | - 'labels': [u'l0', u'l1'], |
4891 | + 'labels': ['l0', 'l1'], |
4892 | 'locked': 1, |
4893 | 'id': 'id0', |
4894 | 'name': 'name0'}, |
4895 | {'hostname': 'h1', |
4896 | 'platform': 'p1', |
4897 | - 'labels': [u'l2', u'l3'], |
4898 | + 'labels': ['l2', 'l3'], |
4899 | 'locked': 0, |
4900 | 'id': 'id1', |
4901 | 'name': 'name1'}] |
4902 | @@ -871,7 +871,7 @@ class atest_unittest(cli_mock.cli_unittest): |
4903 | 'name': 'name0'}, |
4904 | {'hostname': 'h1', |
4905 | 'platform': 'p1', |
4906 | - 'labels': [u'l2', u'l3'], |
4907 | + 'labels': ['l2', 'l3'], |
4908 | 'locked': 0, |
4909 | 'id': 'id1', |
4910 | 'name': 'name1'}], |
4911 | diff --git a/cli/user_unittest.py b/cli/user_unittest.py |
4912 | index af82fa5..85f405e 100755 |
4913 | --- a/cli/user_unittest.py |
4914 | +++ b/cli/user_unittest.py |
4915 | @@ -1,4 +1,4 @@ |
4916 | -#!/usr/bin/python2 |
4917 | +#!/usr/bin/python3 |
4918 | # |
4919 | # Copyright 2008 Google Inc. All Rights Reserved. |
4920 | |
4921 | @@ -11,7 +11,7 @@ import sys |
4922 | try: |
4923 | import autotest.common as common |
4924 | except ImportError: |
4925 | - import common |
4926 | + from . import common |
4927 | from autotest.cli import cli_mock, user |
4928 | |
4929 | |
4930 | @@ -65,15 +65,15 @@ class user_list_unittest(cli_mock.cli_unittest): |
4931 | self.run_cmd(argv=['atest', 'user', 'list'], |
4932 | rpcs=[('get_users', {}, |
4933 | True, |
4934 | - [{u'access_level': 0, |
4935 | - u'login': u'user0', |
4936 | - u'id': 41}, |
4937 | - {u'access_level': 0, |
4938 | - u'login': u'user5', |
4939 | - u'id': 42}, |
4940 | - {u'access_level': 2, |
4941 | - u'login': u'user0', |
4942 | - u'id': 3}])], |
4943 | + [{'access_level': 0, |
4944 | + 'login': 'user0', |
4945 | + 'id': 41}, |
4946 | + {'access_level': 0, |
4947 | + 'login': 'user5', |
4948 | + 'id': 42}, |
4949 | + {'access_level': 2, |
4950 | + 'login': 'user0', |
4951 | + 'id': 3}])], |
4952 | out_words_ok=['user0', 'user5'], |
4953 | out_words_no=['1', '3', '41', '42']) |
4954 | |
4955 | @@ -81,9 +81,9 @@ class user_list_unittest(cli_mock.cli_unittest): |
4956 | self.run_cmd(argv=['atest', 'user', 'list', 'user0'], |
4957 | rpcs=[('get_users', {'login__in': ['user0']}, |
4958 | True, |
4959 | - [{u'access_level': 2, |
4960 | - u'login': u'user0', |
4961 | - u'id': 3}])], |
4962 | + [{'access_level': 2, |
4963 | + 'login': 'user0', |
4964 | + 'id': 3}])], |
4965 | out_words_ok=['user0'], |
4966 | out_words_no=['2', '3']) |
4967 | |
4968 | @@ -91,9 +91,9 @@ class user_list_unittest(cli_mock.cli_unittest): |
4969 | self.run_cmd(argv=['atest', 'user', 'list', '--acl', 'acl0'], |
4970 | rpcs=[('get_users', {'aclgroup__name__in': ['acl0']}, |
4971 | True, |
4972 | - [{u'access_level': 2, |
4973 | - u'login': u'user0', |
4974 | - u'id': 3}])], |
4975 | + [{'access_level': 2, |
4976 | + 'login': 'user0', |
4977 | + 'id': 3}])], |
4978 | out_words_ok=['user0'], |
4979 | out_words_no=['2', '3']) |
4980 | |
4981 | @@ -101,9 +101,9 @@ class user_list_unittest(cli_mock.cli_unittest): |
4982 | self.run_cmd(argv=['atest', 'user', 'list', '--access_level', '2'], |
4983 | rpcs=[('get_users', {'access_level__in': ['2']}, |
4984 | True, |
4985 | - [{u'access_level': 2, |
4986 | - u'login': u'user0', |
4987 | - u'id': 3}])], |
4988 | + [{'access_level': 2, |
4989 | + 'login': 'user0', |
4990 | + 'id': 3}])], |
4991 | out_words_ok=['user0'], |
4992 | out_words_no=['2', '3']) |
4993 | |
4994 | @@ -111,15 +111,15 @@ class user_list_unittest(cli_mock.cli_unittest): |
4995 | self.run_cmd(argv=['atest', 'user', 'list', '--verbose'], |
4996 | rpcs=[('get_users', {}, |
4997 | True, |
4998 | - [{u'access_level': 0, |
4999 | - u'login': u'user0', |
5000 | - u'id': 41}, |
client/ shared/ magic.py - wow, so I'm guessing this code dates back to at least Python 2.2 if there are manual radix calculations.
client/ tools/results2j unit.py: 54 If retval is assumed to be a str then this check might be wrong. I think isinstance(text, str) is what we want, otherwise retval is bytes and bytes does not support replace.