8adf78936c915df6fd1edb6c592f40a7ed8350a5 |
|
09-Sep-2011 |
Dale Curtis <dalecurtis@chromium.org> |
Autotest upstream merge. Merged from d9d64b855363d214996b187380532d4cc9991d29 to 7bad38846fe9c74e42018131ce85aec2b5e6c7a9 BUG=none TEST=emerge autotest, run bvt, smoke. Change-Id: Ibe6462198e84e0d41fa160af086283cd712da4a6 Reviewed-on: http://gerrit.chromium.org/gerrit/7440 Tested-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
/external/autotest/client/common_lib/test_utils/mock.py
|
146df9a9933fb1bf7f94aa8fa6bbccf70e8f320b |
|
15-May-2010 |
jamesren <jamesren@592f7852-d20e-0410-864c-8624ca9c26a4> |
Fix an exception in the unit test mock framework Signed-off-by: James Ren <jamesren@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@4491 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
cd26d048f4ae1e5ec969576e9e0c2f8791f11295 |
|
03-May-2010 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Don't ignore unexpected exceptions. Have the mock report the playback errors inline with the other calls. Signed-off-by: Jean-Marc Eurin <jmeurin@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@4458 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
cd7a81a58c7a1a16105dcd9dca5e9f1680eff65b |
|
21-Apr-2010 |
jamesren <jamesren@592f7852-d20e-0410-864c-8624ca9c26a4> |
Various changes to support further high-level automation efforts. * added a RESTful interface for TKO. right now there's only a single, simple resource for accessing test attributes. * extended the REST server library in a few ways, most notably to support * querying on keyvals, with something like ?has_keyval=mykey=myvalue&... * operators, delimited by a colon, like ?hostname:in=host1,host2,host3 * loading relationships over many items efficiently (see InstanceEntry.prepare_for_full_representation()). this is used to fill in keyvals when requesting a job listing, but it can (and should) be used in other places, such as listing labels for a host collection. * loading a collection with inlined full representations, by passing full_representations=true * added various features to the AFE RESTful interface as necessary. * various fixes to the rest_client library, most notably * changed HTTP client in rest_client.py to use DI rather than singleton, easing testability. the same should be done for _get_request_headers(), to be honest. * better support for query params, including accepting a MultiValueDict and supporting URIs that already have query args * basic support for redirects * builtin support for requesting a full collection (get_full()), when clients explicitly expect the result not to be paged. i'm still considering alternative approaches to this -- it may make sense to have something like this be the default, and have clients set a default page size limit rather than passing it every time. * minor change to mock.py to provide better debugging output. Signed-off-by: Steve Howard <showard@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@4438 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
a1e7bc91244ac856079d03159236fe5a73076089 |
|
26-Mar-2010 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Fix bug when comparing lists. zip is used to compare corresponding items from each list. But zip of unequal length lists justs zips the shortest length. For example, zip([], [1,2]) yields []. This is not what you want. So I make sure the lists are the same length before the zip. I doscivered this when comparing 2 dicts which becomes a list comparison of keys... Signed-off-by: John Fodor <fodor@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@4347 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
0d0f67d6abcf6599ad626042d3236020e093558f |
|
06-Nov-2009 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Create a base_job class in the common library as a location to refactor common code from client/bin/job.py and server/server_job.py into. Initially this just creates the base class and attempts to refactor some of the __init__ code into it. It also tries to refactor the code somewhat so that it's easier to test without mocking out large amounts of external dependencies. It also tries to standardize on what all the official publicly usable attributes are, mostly on the basis of looking at what the existing code actually does. In general my approach was: * If used outside of the job class, assume it's public. If it makes sense make it a requirement of the base class, but in some cases (e.g. serverdir) it really only makes sense for one of the concrete classes. In that case I define it as "OPTIONAL", which means it can be None (but must still be defined). * If only used within the job class, make it "private", which means it gets a name starting with _. Code outside of the job modules shouldn't be touching these. This includes the "constants" that we define with all-caps in the class. * I added unit tests which try to actually validate this, by checking that all the correct properties are defined after __init__. The test cases are still limited (all the test_init cases) because of the pain of stubbing out __init__, but I will be adding more in the future as I refactor to reduce the amount of mocking/stubbing needed. Overall, I don't know that this change by itself makes the code simpler or easier to understand, but I don't think it makes things any worse in that regard, while adding a lot more testing and finally giving us a well-defined interface. I have more changes planned, but as new improvements kept creeping into this change I decided to mail it out for some review instead of letting it grow even bigger. Some ideas of what I still intend to do in followup patches: * Refactor more of the directory management code into job_directory, to get the rest of the mkdir/makedirs code into there. That way all of the directory management is concentrated in one place. * Refactor all the of get_state/set_state code into something that automatically handles this with properties without a lot of boilerplate getter and setter methods. * Refactor the job.record related code that's duplicated into the base class. Risk: High Visibility: Mostly code changes to standardize the job class interface. A lot of the visible changes just involve privatizing attributes that aren't used outside of job anyway, or adding in attributes that were only defined on the client or server. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@3916 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
aea51ccb4a4a277b2796916eab043e8b91e56649 |
|
30-Oct-2009 |
jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> |
Tweak the stubbing in mock.py to handle a very subtle case. When you stub out something like a method on an instance when you unstub you want to put things back in their original state. But restoring the original result of getattr onto the instance doesn't do that, because the attribute may actually be inherited from some enclosing namespace; for example instance methods actually come from the instance.__class__ object, not the instance itself. Risk: Low Visibility: Fixes up a case where the mock library doesn't actually properly unstub. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@3892 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
5644da874403e1b4676bfffbaef202812e8b4464 |
|
02-May-2009 |
showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> |
Make mock.py fail fast when an unexpected call occurs by throwing an exception. Signed-off-by: Steve Howard <showard@google.com> Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest git-svn-id: http://test.kernel.org/svn/autotest/trunk@3085 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
170873e8869cae8bb9499d6128cf626e8110bf56 |
|
07-Jan-2009 |
showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> |
Attached is a very large patch that adds support for running a distributed Autotest service. Previously, the scheduler could only execute autoservs locally and all results were written directly to the local filesystem. This placed a limit on the number of machines that could be concurrently tested by a single Autotest service instance due to the strain of running many autoserv processes on a single machine. With this change, the scheduler can spread autoserv processes among a number of machines and gather all results to a single results repository machine. This allows vastly improved scalability for a single Autotest service instance. See http://autotest.kernel.org/wiki/DistributedServerSetup for more details. Note that the single-server setup is still supported and the global configuration defaults to this setup, so existing service instances should continue to run. Steve Signed-off-by: Steve Howard <showard@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@2596 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
025d1e158bd55100301a0fdf4b2f6beb1009a025 |
|
15-Dec-2008 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Adds an expect_any_call method for when you want it to be called but verifying the exact arguments just is not worthwhile. Signed-off-by: Gregory Smith <gps@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@2567 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
b9d055122081a7a0a159770c5df60bb8f5f187cd |
|
18-Oct-2008 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Adds an open_write_close() convenience func that does the right thing without depending on python being reference counted to close (flush) the file. (that works today in C Python but is bad to depend on) Also changes the existing similar write_one_line() function to explicitly call close rather than just flush(). The unittest's fake file object injection needed updating as a result. Signed-off-by: Gregory Smith <gps@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@2299 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
a5daed5b2e8735a174483ed1b6691ee77a0d0d39 |
|
30-Sep-2008 |
jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> |
Change the mock framework to treat properties like "special" methods, i.e. ignore them. Unfortunately, the way our mock system works we can't easily integrate property mocks into them so for now just exclude them so that you can still use the mocks to test non-property parts of the code. Risk: Low Visibility: Unit tests with classes that have properties will not fail immediately, although you won't be able to mock the properties. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@2209 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
901aaa9ca3aace4d33fd5441c66493e867a0db89 |
|
27-Aug-2008 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Python 2.5 optparse capitalizes Usage, 2.4 doesn't, so remove this word from the unittest. The unittest parallel.redirect_io() redirects stdout & stdin, which didn't play well with the god.mock_io(). Risk: low (unittest only) Visibility: med (make them work with python 2.5) Signed-off-by: Jean-Marc Eurin <jmeurin@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@2057 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
56193bb485d65716526079449f1df86ba5cb2df5 |
|
13-Aug-2008 |
showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> |
-add basic abort functionality test to scheduler unit tests. this involved some serious refactoring of the existing tests. -various other enhancements to the scheduler unit tests. -extend mock.py comparator logic to be more powerful and generic. it can now handle comparators within data structures, and it handles keyword args properly. -enhance debug printing in mock.py. previously a test failure before calling check_playback would cause errors to be hidden even though they contained the cause of the failure. now, with debug mode enabled, errors will be printed as soon as they occur. -minor changes to monitor_db.py to increase testability. git-svn-id: http://test.kernel.org/svn/autotest/trunk@1981 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
2e4726754f397c142a4cf90e840a385c5e7605dd |
|
28-Jul-2008 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
This change to mock.py fixes two major issues. 1) when calling check_playback() we should clear out the recording at the end of the call so failures in one test dont cascade through. 2) we should rename the record and playback attributes of mock class to __record and __playback since the object being mocked may have a __record or __playback and we will cover that up (i.e. job.record()) Signed-off-by: Travis Miller <raphtee@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@1911 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
27d0cb998bf965902689ce162ca790cae25c95f3 |
|
12-Jun-2008 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Make sure that error messages from god are already displayed. Remove the exit mock as it should now be now as a regular stub. Rename stdout_stderr to io. Signed-off-by: Jean-Marc Eurin <jmeurin@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@1695 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
f81731631a3dd2d8c9bef197d83571a36c9021f6 |
|
11-Jun-2008 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Previous the calls to expect_new on a mock_class_obj were not being recorded in the god. Now they are and so can check that object creations occur correctly in the method under test. Signed-off-by: Travis Miller <raphtee@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@1673 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
6e83b6f6f33845f700de049f5f64fa448b667ed5 |
|
10-Jun-2008 |
mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> |
Had to change a few classes to be new style python classes. This is done since I am having to mock out these classes and they need to be new style for that to work in our mock framework. The other change was to allow mock_god to unstub a specific method. The bulk of the new code is in job_unittest.py which tests job.py. had to make a couple of changes to job.py that involve changing __ to _. Signed-off-by: Travis Miller <raphtee@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@1668 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
0afbb6369aa5aa9a75ea67dd9e95ec4b21c0c181 |
|
06-Jun-2008 |
jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> |
Convert all python code to use four-space indents instead of eight-space tabs. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@1658 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
943424580cb9a8ae989aea07f82fc0f56b439f53 |
|
06-Jun-2008 |
jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> |
Add in a bunch of new mock utils, for mocking out stdout, stderr, exit, performing isinstance comparisons, etc. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@1638 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|
3d161b028a4cd20c0a91ee5b1b86149a0821db4f |
|
06-Jun-2008 |
jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> |
Move the mock libraries from client/unittest into client/common_lib/test_utils. This is a better location, and a rename of the package dir from unittest to test_utils avoids some conflicts that were occuring between it and the stdlib unittest module. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: http://test.kernel.org/svn/autotest/trunk@1637 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/client/common_lib/test_utils/mock.py
|