Commit Graph

47 Commits

Author SHA1 Message Date
Cole Robinson 758eb74ba3 Replace deprecated `imp` usage with `importlib`
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2021-10-04 16:04:44 -04:00
Pino Toscano fdc621e05f tests: force an English UTF-8 locale
Various checks in the test suite try to match for error/status messages,
so using a localized libvirt (or even using translations of an installed
version of virt-manager in the system) makes those check fail.
Hence, force (using $LANG, and unsetting $LANGUAGE) an English UTF-8
locale.

Thanks Cole Robinson for spotting the right place where to inject the
locale settings.

Fixes: #199

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-12-07 13:50:00 -05:00
Cole Robinson a2829e65e9 tests: Don't show debug output by default on failure
Require --log-level=debug to see output

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson 61a947d667 tests: Rename clistate -> TESTCONFIG
Makes it more clear it's a constant class, and its purpose

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:38:40 -04:00
Cole Robinson 8fe0a208db Move virt-* code into their modules
This layout is closer to what most python modules have nowadays.
It also simplifies testing and static analysis setup.

Keep virt-* wrappers locally, for ease of running these commands
from a git checkout.

Adjust the wrapper binaries we install on via packaging to be
pure python, which makes things like running gdb easier.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 18:27:20 -05:00
Cole Robinson ee9f93074b Remove virt-convert
This was raised here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

Quoting from that:

"""
virt-convert takes an ovf/ova or vmx file and spits
out libvirt XML. It started as a code drop a long time ago that could
translate back and forth between vmx, ovf, and virt-image, a long dead
appliance format. In 2014 I converted it to do vmx -> libvirt and ovf ->
libvirt which was a CLI breaking change, but I never heard a peep of a
complaint. It doesn't seem to do a particularly thorough job at its
intended goal, I've seen 2-3 bug reports in the past 5 years and
generally it doesn't seem to have any users. Let's kill it. If anyone
has the desire to keep it alive it could live as a separate project
that's a wrapper around virt-install but there's no compelling reason to
keep it in virt-manager.git IMO
"""

Nothing has changed since then, so here is the removal.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:29 -05:00
Cole Robinson 78ad233653 tests: abide logging options for clitests
We need to restore logging after calling the cli tools. Centralize
the logging reset behavior since we need that too

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-12-11 17:57:28 -05:00
Cole Robinson f4d62660f1 tests: Don't use the root logger
Stops logging spam from requests
2019-07-16 16:53:22 -04:00
Cole Robinson f107e39989 Switch to more traditional logging structure
Init a shared log instance in virtinst/logger.py, and use that
throughout the code base, so we aren't calling directly into
'logging'. This helps protect our logging output from being
cluttered with other library output, as happens with some
'requests' usage
2019-06-17 00:12:31 -04:00
Cole Robinson ab7b3c189f Move virtcli/cliconfig.py to virtinst/buildconfig.py
There's really no reason for the split, just contain it all
within virtinst for simplicity
2019-06-14 17:12:19 -04:00
Cole Robinson 384607e502 cli: Strip find_inst regex from completion results
It doesn't really work with the argcompleter, so show the non-regex
version of the suboption
2019-05-15 13:18:39 -04:00
Cole Robinson 7a2abb5abf installer: Remove --location nfs support
Removal was discussed here:
https://www.redhat.com/archives/virt-tools-list/2018-May/msg00011.html

Basically I don't think many people use this, the feature is very
inflexible, it's hard to test, and users can essentially do it
themselves with a bit more effort.
2018-06-12 14:07:50 -04:00
Daniel P. Berrangé 48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson c05cd52772 setup: Use CLIState for setting --debug value 2018-02-22 15:18:47 -05:00
Cole Robinson c7ed34de63 tests: test_urls: Big rework
Move all the test cases to an .ini file. Various cleanups and
minor improvements throughout
2018-01-06 14:04:34 -05:00
Radostin Stoyanov 44de92b772 Use reload() from imp module
In Python 3 the reload() function [1] has been moved in the imp
module. [2]

[1] https://docs.python.org/2/library/functions.html#reload
[2] https://docs.python.org/3/library/importlib.html#importlib.reload
2017-10-20 13:18:31 -04:00
Cole Robinson 0055798d21 tests: Move __init__ logic into functions, for clarity 2017-02-23 18:47:57 -05:00
Cole Robinson df5c688c11 tests_inject: Update to use standard --only option
Rather than custom --distro option. And fix the URL list
2016-06-17 18:41:50 -04:00
Cole Robinson f4dfb6de9d Fix recent pylint/pep8 output 2016-04-18 16:42:12 -04:00
Cole Robinson 0273ee2fac tests: Move some test suite hacks into the code, increase coverage 2015-03-23 16:25:31 -04:00
Cole Robinson 8220e4c60f virtinst: Drop unused stable_defaults field 2015-03-23 16:17:07 -04:00
Cole Robinson baee53fbaa util: Simplify default_bridge to not confuse pylint 2014-10-27 19:53:25 -04:00
Cole Robinson 5aafe008bc Remove virt-image, as scheduled
As promised with the last release, remove virt-image. In 6 months I didn't
hear a peep from any actual users that cared.
2014-09-06 18:05:43 -04:00
Cole Robinson a398d245cb Clean up pylint integration
- Drop no longer needed disable= bits
- Use string names for all skipped pylint messages
2014-04-02 19:00:24 -04:00
Cole Robinson 797afb3b27 virt-install: Fix --location iso again, and test it (bz 1071513) 2014-03-06 12:46:46 -05:00
Cole Robinson d76aab264e tests: Only use one env variable to notify we are running tests 2014-02-10 14:47:20 -05:00
Chen Hanxiao dbfa8166b1 virt-xml: fix a terminal_width depends issue
One of virt-xml test case will output logs by
urlgrabber.process, which will get the real width of
terminals.
If we resize terminal, of who is running test, from
80 to other size, test case will fail.
This patch will screen it when running test case.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-02-07 23:05:41 +08:00
Cole Robinson 748ff1c4cc virt-xml: Initial commit, basic set of tests 2014-01-25 17:20:29 -05:00
Martin Kletzander dc0b9bbaaf Rename hide_unsupported_rhel_options to stable_defaults and clean-up its usage
There were multiple problems with the setting and usage of
hide_unsupported_rhel_options.  Due to the fact that the option has
several diferent namings throughout the code, this patch is renaming
it to stable_defaults, which basically says what the option does and
makes it possible to use it without need for more than one negation
(where the old code had up to 4 of them in some places), which also
helps understanding it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-01-21 17:13:18 +01:00
Giuseppe Scrivano 2a040ccd17 mass update: remove double spaces from comments
Updated by this script:

find -name '*.py' -exec sed -i "s|^\(#.*[^.?\!]\)  \(.*[^#]\)$|\1 \2|g" \{\} \;

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2013-10-28 17:22:31 +01:00
Giuseppe Scrivano 0df75c7603 headers: update "Red Hat, Inc." copyright for the year 2013
Ensure that any file touched by a @redhat.com author in 2013 has an
updated copyright header.

The files were updated using the build-aux/update-copyright gnulib
script and manually added where the copyright line wasn't present.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2013-10-28 17:22:26 +01:00
Cole Robinson c136fde04d cliconfig: Use default values if we're in the test suite
We were doing this by hand more or less, but this way is more future
proof.
2013-10-02 18:42:51 -04:00
Cole Robinson 4f59c24b40 tests: Add test_initrd_inject command
This is a standalone test like test_urls, and requires interraction. It
pulls down a bunch of kernels from public URL trees, inject known
kickstarts that induce quick failure. User inspects the output to
ensure initrd inject is working as expected.
2013-09-28 16:50:08 -04:00
Cole Robinson 74a2ab5612 test_urls: Fix --path option 2013-09-26 18:32:50 -04:00
Cole Robinson 623edd1a84 tests: Clean up cli imports even if --skipcli passed 2013-08-06 14:58:43 -04:00
Martin Kletzander 9f37f58804 Fix tests that fail due to default graphics change
As pointed out, the tests were configuration-dependent and thus might
have failed in case './setup.py configure' was run with non-default
graphics.  The default graphics has changed as well and that lead to
test disaster.  Reverting first hunk of commit b8a209ef and making the
tests independent of default graphics configuration makes all the
failures go away.
2013-07-17 08:14:34 +02:00
Cole Robinson e04dfdd4ff virtinst: Test rhel defaults, and make sure it doesn't break test suite 2013-07-13 20:01:07 -04:00
Cole Robinson ce243314c0 tests: Verify that every new style XML prop is exercised
coverage isn't going to help us much here, so add some hacky infrastructure
to ensure that xmlparse.py is touching every new style xmlprop.
2013-07-12 15:19:37 -04:00
Cole Robinson 3005382e0d Make is_blktap_capable take a connection
So we don't perform the check if we're using a remote connection
2013-07-06 12:44:53 -04:00
Cole Robinson ea2a1331cf virtinst: Guest: Simplify passing in a connection 2013-07-03 13:37:00 -04:00
Cole Robinson a386186c74 Remove most map() and filter() usage
They aren't available on python3 so pylint complains, and list
comprehensions are usually better.
2013-04-12 08:27:44 -04:00
Cole Robinson c5e45ae448 Remove all relative imports
We also drop VirtualDevice from the 'public' virtinst API, since there
are better ways to get its info.
2013-04-12 08:27:44 -04:00
Cole Robinson 459cb3de5e util: Remove old default_bridge, rename default_bridge2 2013-04-11 12:15:37 -04:00
Cole Robinson 3bce20d974 virtinst: Combine util.py and _util.py
Was originally split to not pollute the public API, but we aren't public
anymore
2013-04-11 12:15:37 -04:00
Cole Robinson d6c8ad0297 Wire up python unit tests, unify gettext setup 2013-04-03 18:22:05 -04:00
Cole Robinson 88603e4fad Merge code from python-virtinst.git
As outlined here:

https://www.redhat.com/archives/virt-tools-list/2012-February/msg00040.html

For now this is just a direct import of the code from virtinst commit
dca5a4d6245f21d554f8853197a6a234bfc8e52c. History is not merged, so
please refer to original git for detailed commit histor:

http://git.fedorahosted.org/cgit/python-virtinst.git/
2013-04-03 18:22:05 -04:00