- 13 10月, 2017 8 次提交
-
-
由 Cleber Rosa 提交于
Basically switch to use the alias provided by six, with the Python 3 name. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
Instead of the iterator next method. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The current code, which doesn't close the file, produces "ResourceWarning: unclosed file" in Python 3. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
This test currently creates some Avocado test instances (as part of the test itself) that doesn't get used. Let's limit the creation to where they're used. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The test that makes sure an exception is raised is completely isolated from the other checks, and can be made a test of its own. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The filter attribute and the del statement do not seem to be necessary here. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The use of PathInspector checks too much and too little at the same time. For once, it attempts to find Python code inside a file that doesn't have a '.py' suffix. This means that a file named "test" instead of "test.py" can be recognized as an INSTRUMENTED test. A file no ending in ".py" can not be currently loaded as a Python module by Avocado, and it results in a test execution ERROR. This changes the behavior for files with Python code, but not ending in '.py' that can not be loaded as INSTRUMENTED tests, and will now result in NOT_A_TEST instead. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 12 10月, 2017 3 次提交
-
-
由 Cleber Rosa 提交于
Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Lukáš Doktor 提交于
Our "astring" library used to be encoding-lenient, let's bring back the fall-back way of translating unfriendly chars in case the user passes unicode. Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
-
由 Lukáš Doktor 提交于
The FS_UNSAFE_CHARS could be useful to users when dealing with filenames but not in need of the full "string_to_safe_path" function. The FS_TRANSLATE was also brought back, but it's usability outside this module is questioned, therefor it's created as private variable. The reason to include this on module level is to only create the translation once and not per each call. Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
-
- 11 10月, 2017 7 次提交
-
-
由 Lukáš Doktor 提交于
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com> * https://github.com/avocado-framework/avocado: Removed port related information while returing location
-
由 Amador Pahim 提交于
Signed-off-by: NAmador Pahim <apahim@redhat.com>
-
由 Amador Pahim 提交于
Signed-off-by: NAmador Pahim <apahim@redhat.com>
-
由 Cleber Rosa 提交于
This changes uses the six compatibility equivalents for iterkeys, iteritems and itervalues. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Amador Pahim 提交于
Signed-off-by: NAmador Pahim <apahim@redhat.com>
-
由 Cleber Rosa 提交于
The main goal here is to make string_to_safe_path behave properly under Python 3. The big change here is the added code that selects the module where the maketrans() function is located, which in Python 3 is a static method of bytes. Additionally, it removes the module level definitions (FS_UNSAFE_CHARS, FS_TRANSLATE) which don't have any other use so far. FS_USNAFE_CHARS has become a simple variable, now expressed as a sequence of bytes. If other characters are added to the translation table, maketrans() will make sure the they are the same size, so I believe the code to generate the second argument of the same size can be dropped. Now, a side effect is that, on Python 2, the result of the json parsing (json.loads()) is a dict with unicode keys and values. When that is passed to the updated string_to_safe_path() implementation, a causes TypeError is raised (from Objects/unicodeobj.c, charmaptranslate_lookup()). Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
And its related functions (callers and callees). In Python 3, strings are unicode, so an encode operation will return a byte object, while a decode (on a byte or bytearray) will return a string (unicode). To start with, string_safe_encode() wants to solve the problem of users mising unicode and other encoded strings, which doesn't make sense for Python 3. Additionally, it uses encode and decode in a way that is very specific to Python 2, such as assuming the result of a decode() can then be "encode()d" and still be a string. For Python 3, the idea here is to *not* deal with any encode/decode operations attempting to get a "safe" string. The first part of the function, which converts non-string objects to string, is still being relied upon by some code, so it's kept (at least for now). Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 10 10月, 2017 2 次提交
-
-
由 Venkat R B 提交于
Earlier function used to return the entire physical slot location including port information if any. Now it returns slot information only till adapter level, not the port level. Signed-off-by: NVenkat R B <vrbagal1@linux.vnet.ibm.com>
-
由 Cleber Rosa 提交于
This is a mass change for something that has proved right (it was applied on previous commits on a as-needed basis). To avoid having to hit the same issues over and over again, let's change all occurences. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 09 10月, 2017 1 次提交
-
-
由 Amador Pahim 提交于
Signed-off-by: NAmador Pahim <apahim@redhat.com>
-
- 06 10月, 2017 12 次提交
-
-
由 Lukáš Doktor 提交于
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com> * https://github.com/avocado-framework/avocado: Project infrastructure removal of flexmock selftests/unit/test_vm.py: port from flexmock to mock selftests/unit/test_utils_partition.py: port TestMtabLock.test_lock to mock selftests/unit/test_test.py: port test_all_dirs_exists_no_hang to mock selftests/unit/test_test.py: remote flexmock requirement of test_long_name selftests/unit/test_datadir.py: port test_settings_dir_alternate_dynamic to mock selftests/unit/test_datadir.py: port test_unique_log_dir to mock selftests/unit/test_datadir.py: port test_datadir_from_config to mock selftests/unit/test_distro.py: port from flexmock to mock (unittest.mock) selftests/unit/test_remote.py: port from flexmock to mock (unittest.mock) RemoteTestRunner: fix description of setup() method
-
由 Cleber Rosa 提交于
This commit revomes flexmock from the various requirements file, from the RPM SPEC file. Starting here, it's officially no longer an Avocado dependency. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The approach used on this port is to avoid excessive mocking, like the test_remote.py port, and use the real code, unless when insteracting with dynamic and non-existing components (such as a the hypervisor or running domain). A partial list of the changes when compared to the previous version: * Args was made into a real argparse.Namespace instance because there's no need for it to be a mocked object. Actually, it is better to have an exact object instance, rather than a mock when it's possible to. * The "references" attribute being set on the, then mocked, job instance has been dropped, because the natural way of passing that to the job is using the "reference" key in args. Also, while purely cosmetic, the references that look like the example instrumented tests have been renamed (passtest -> passtest.py). * Removal of JSON_RESULTS, which was not being used in the test. * Use dry_run and clean up job results. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
And remove module flexmock requirements. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
And remove the requirement on flexmock on this module. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
Basically, this is not about switching to mock instead, because mocking properties is more challeging with mock, and mocking a property of an existing instance is, to the best of my knowledge, not possible. So, it seemed like a good idea to use a different test class with an overloaded property that returns the fake filename, and while at it, separate split that into two other tests. It should be easier to understand what each block (now a test) is about. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
Pretty straightforward port, not really any remarks besides another test file becoming flexmock free. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
Besides the obvious port, I reckon that using a more obvious fake return value for the return of `time.strftime` improves the legibility of the test. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The context manager feature of mock.patch replaces a lot of the code that restores the original state. Besides that, one explicit assert was added to make sure that the non-patched state is what we expect. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The first line says it all, this is a pretty straightforward port. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
This is a port to the mock library that is in the standard in Python 3, and it's available in Python 2, and already a requirement for Avocado. The approach used on this port is to avoid excessive mocking, and use the real code, unless when insteracting with dynamic and non-existing components (such as a remote system). A partial list of the changes when compared to the previous version: * Args was made into a real argparse.Namespace instance because there's no need for it to be a mocked object. Actually, it is better to have an exact object instance, rather than a mock when it's possible to. * The "references" attribute being set on the, then mocked, job instance has been dropped, because the natural way of passing that to the job is using the "reference" key in args. Also, while purely cosmetic, the references that look like the example instrumented tests have been renamed (passtest -> passtest.py). * The "unique_id" attribute being set on the, then mocked, job instance had a value (1-sleeptest;0) completely incompatible with job IDs, and was removed from being set manually. * This version does *not* mock "low level" remote execution of commands, such as running "env" or "avocado -v" on the remote host. Instead, it mocks the end result of check_remote_avocado completely. * The extra test on RemoteTestRunner.setup() seems unnecessary, because that is part of the run_suite() workflow. * Checking if `__init__` was called is not be possible with mock. See https://docs.python.org/3/library/unittest.mock.html#mocking-magic-methodsSigned-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The goal of this change is to make the behavior of the Avocado command line application as similar as possible to the behavior when running under Python 2. This bit is about what happens when the simplest possible Avocado command line is run: $ avocado On Python 2, it prints the complete usage, along with the error message "too few arguments". While we could go employ extreme changes to make the very same error message be given on Python 3, this seems wrong. The reason is that the message is generated by the Python 2 standard library. The Python 3 standard library relies on "required" arguments instead. When settings the subcommand sub parser as a required option, the behavior is exactly the same, minus the error message which becomes "the following arguments are required: subcommand". Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 05 10月, 2017 5 次提交
-
-
由 Cleber Rosa 提交于
Let's make this test more in line with the unittest.TestCase style, making use of the assertions, whose failures can be point us to the exact location of the failure. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The current test loops over the result directory versions, and while it aggregates and prints the individual failures, the unittest framework has the same purpose. To me, as a user, I'd rather know that test "xyz" failed right away, than having to parse the output of a longer text message. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Amador Pahim 提交于
Signed-off-by: NAmador Pahim <apahim@redhat.com>
-
由 Amador Pahim 提交于
Signed-off-by: NAmador Pahim <apahim@redhat.com>
-
- 04 10月, 2017 2 次提交
-
-
由 Cleber Rosa 提交于
Mock is slightly lighter than MagicMock, which is only necessary when mocking "magic" methods. So, let's revert to the lighter Mock class. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
This module already uses mock, but doesn't import it in a way that is usable on Python 3. Also, let's make the style the same as in the other modules that import conditionally for Python 2 and 3. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-