- 25 4月, 2018 1 次提交
-
-
由 Cleber Rosa 提交于
test_run_sudo() actually needs sudo, because it attempts to run it. Let's check for the file at the usual location, and skip the test unless it exists. ERROR: test_run_sudo (selftests.unit.test_utils_process.TestProcessRun) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched return func(*args, **keywargs) File "selftests/unit/test_utils_process.py", line 180, in test_run_sudo p = process.run(cmd='ls -l', sudo=True, ignore_status=True) File "avocado/utils/process.py", line 1272, in run cmd_result = sp.run(timeout=timeout) File "avocado/utils/process.py", line 781, in run self._init_subprocess() File "avocado/utils/process.py", line 571, in _init_subprocess raise details OSError: [Errno 2] No such file or directory (/bin/sudo -n ls -l) Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 21 4月, 2018 4 次提交
-
-
由 Cleber Rosa 提交于
This change introduces the following requirement: the command to be run by the avocado.utils.process functions should be given as unicode. It brings a clearer interface, in which there's no need to deal with encodings internally. For simple test, it brings changes to respect the of passing unicode. And, it changes the presentation of simple tests with unicode names explicitly expreseed as such. The way to deal with the process data that may be generated on stdout/stderr is unchanged. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
On the basis of the non-existence of the "true" command on the system running tests. Most of the tests do not even reference the "true" command, and those that do, do not require the binary to exist, but only a valid command line to be given. In that aspect, a fictional command is used where needed. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
The sudo related test are currently broken in the following aspects: 1) it doesn't require TRUE_CMD 2) the monkey patching of find_command() produces and adverse effect, and makes the binary we look for ("sudo") become "true" 3) the expected results reflect the wrong sudo binary Let's fix those aspects, making sure the process.py library looks for sudo only, and that it prepends that (the found sudo binary) to the generated command. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 26 3月, 2018 1 次提交
-
-
由 Cleber Rosa 提交于
And only if the method is not available, attempt to fallback to the stdout itself if it is a string. Before 30617c1e, the following kind of check was done: >>> type(bytes('foo')) in string_types False And after it, the check was changed to: >>> isinstance(bytes('foo'), string_types) True That made the bytes decoding not to be performed at times. While the new check is correct, we should favor the attempt to decode, and only if not available, fallback to the original stdout if it looks like a string. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 21 3月, 2018 2 次提交
-
-
由 Cleber Rosa 提交于
Sometimes, the command to be executed is a string encoded a specific encoding, different than the system or hard coded default. Let's make the encoding configurable, and it will apply also to the content produced by the command. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Lukáš Doktor 提交于
The `path.find_command` raises exception in case it fails to find the binary. Let's use the same approach as in `selftests.functional.test_basic` to get binary or skip individual tests. Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
-
- 15 3月, 2018 1 次提交
-
-
由 Cleber Rosa 提交于
The FDDrainer can fail to flush due to some other conditions, including when the stream handler is a plain StreamHandler, and not a FileHandler. Let's add tests that cover this situation, and another one that's already fixed that deals with closed streams. Reference: https://github.com/avocado-framework/avocado/pull/2512Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 26 2月, 2018 1 次提交
-
-
由 Cleber Rosa 提交于
In situations where a user of the CmdResult class manually sets the stdout/stderr attributes to a string, instead of the recommended and documented content of type "bytes", it won't be possible to "decode" the bytes into a string of a given encoding, and we'll end up with a crash. Since the goal of std{out,err}_text is to return a text version of stdout, if itself already is of such a type, let's just return it. Additionally, if the data cannot be "decode()d", let's raise an explicit TypeError on this location, rather than later in the code when its value is attempted to be used. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 22 12月, 2017 1 次提交
-
-
由 Cleber Rosa 提交于
That's the only sane way to handle data, as bytes. Let's not assume any enconding on them. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 29 11月, 2017 1 次提交
-
-
由 Cleber Rosa 提交于
The FDDrainer reads from the PIPEs and writes to both the internal StringIO instances and to stream logging handlers. There are no guarantees that the logging handlers will flush the content before the FDDrainer finishes. Let's explicitly close all the handlers (which should really be FileHandlers) associated with the stream loggers, which should flush and sync the content on the files themselves. Additionally, the combined drainer was being missed from the flush process, and was causing some output in that mode to be unavailable on generated output. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 18 11月, 2017 2 次提交
-
-
由 Cleber Rosa 提交于
This is refactor of the current locks/file/threads created in the SubProcess class to a more contained an isolated (and tested) block of functionality. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
由 Cleber Rosa 提交于
And raise an exception early if an invalid value is given. Signed-off-by: NCleber Rosa <crosa@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>
-
- 08 3月, 2017 1 次提交
-
-
由 Lucas Meneghel Rodrigues 提交于
Some Unixes won't have /bin/true, so let's make life easier for those other OS to run the unittests. Signed-off-by: NLucas Meneghel Rodrigues <lookkas@gmail.com>
-
- 06 2月, 2017 1 次提交
-
-
由 Cleber Rosa 提交于
The unittest standard library on Python 2.7 an later has everything that the unittest2 backport is supposed to have. Let's then drop all the conditional imports of unittest2 and stick with unittest. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 07 11月, 2016 1 次提交
-
-
由 Lukáš Doktor 提交于
Recent pylint update is more pedantic about module level spacing. There are no changes to code, only couple of extra spaces to make it happy. Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
-
- 15 2月, 2016 1 次提交
-
-
由 Lukáš Doktor 提交于
This unittest patches find_command to return /usr/bin/sudo and then runs it and expects some results. This works only with correctly set sudo, but it does not work without sudo (as the binary is not found) or with incorrectly set sudo. Let's use "/bin/true" instead. Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
-
- 12 2月, 2016 1 次提交
-
-
由 Lukáš Doktor 提交于
This function is useful, when one executes shell=True commands where he sets values and then executes command. He can use this function to get the actual binary path instead of the first variable=value assignment. Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
-
- 27 1月, 2016 1 次提交
-
-
由 Lucas Meneghel Rodrigues 提交于
Some commands do require admin privileges to run, but we can't use the 'root' user in some testing scenarios [1]. So let's add a 'sudo' parameter to process.run(), process.system() and process.system_output() interfaces, that will append a sudo command to the original command string, causing it to be executed under sudo. The basic assumption here is that the user executing the tests was added to the sudoers file in such a way that it can run administrative commands without a password. [1] One specific environment where we can't use the root user is when avocado runs on an AWS (Amazon Web Services) instance. Signed-off-by: NLucas Meneghel Rodrigues <lookkas@gmail.com>
-
- 28 11月, 2015 2 次提交
-
-
由 Lukáš Doktor 提交于
shlex.split() can fail on some strange commands (eg. on an unfinished quotation). This patch fallbacks to simple string.split() in such cases, which might return incorrect results, but is safer to use. Although it logs warning about this notifying the user about possible issue. Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
-
由 Cleber Rosa 提交于
It has been reported that avocado crashes when a malformed command is attempted to be executed, even when using `shell=True`. The reason is that `shlex.split` will raise `ValueError` on those commands. Since improving `shlex.split` may be too complex, and possibly not the best place to "fix" this, let's just assume safely that this command should be run on GDB. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 03 9月, 2015 1 次提交
-
-
由 Cleber Rosa 提交于
To be honest, our test code could still be kept in the same directories and have the same names. But I think we can improve two things here: 1) Flatten a little bit the directory structure of selftests. Two path components are being dropped here: "all" and "avocado". So that "selftests/all/functional/avocado" becomes simply "selftests/functional". 2) File names match what is, by default, recognized by unittest (the Standard Library module) based discovery of tests. That means that doc_build_test.py becomes test_doc_build.py. Not a big deal IMHO. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 13 6月, 2015 1 次提交
-
-
由 Cleber Rosa 提交于
Instead of having a "common ground" that two namespaces would import and share runtime information, let's just make the plugin set the defaults for the module. This is quite appropriate, both regarding the namespace where the configurations are kept (in the avocado.utils.gdb module itself) and also regarding the single direction of module layering. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 18 3月, 2015 1 次提交
-
-
由 Lucas Meneghel Rodrigues 提交于
Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
-
- 29 1月, 2015 1 次提交
-
-
由 Cleber Rosa 提交于
Self test files used to be executable, but that changed on 143b574c. So, it doesn't make much sense to keep the shebangs + python commands on them. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-
- 10 9月, 2014 1 次提交
-
-
由 Cleber Rosa 提交于
So that any code using our process API can be run through a debugger. Signed-off-by: NCleber Rosa <crosa@redhat.com>
-