diff options
author | Cole Robinson <crobinso@redhat.com> | 2018-02-13 19:04:08 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2018-02-14 11:08:09 -0500 |
commit | 8917305a6e1dbaf1090334ad7b510a2376e47319 (patch) | |
tree | 0c018af638e1aa02526aac844e78e4037448c423 /tests | |
parent | ab884b620f5f5418e7f072b852d2b29d15de4320 (diff) | |
download | virt-manager-8917305a6e1dbaf1090334ad7b510a2376e47319.tar.gz |
Don't use count() for substring checking
Use the idiomatic 'X in Y'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/clitest.py | 16 | ||||
-rw-r--r-- | tests/test_urls.py | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/clitest.py b/tests/clitest.py index 2edc011a..abdd9b92 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -156,13 +156,13 @@ class Command(object): exc = "" try: - if app.count("virt-install"): + if "virt-install" in app: ret = virtinstall.main(conn=conn) - elif app.count("virt-clone"): + elif "virt-clone" in app: ret = virtclone.main(conn=conn) - elif app.count("virt-convert"): + elif "virt-convert" in app: ret = virtconvert.main(conn=conn) - elif app.count("virt-xml"): + elif "virt-xml" in app: ret = virtxml.main(conn=conn) except SystemExit as sys_e: ret = sys_e.code @@ -316,13 +316,13 @@ class App(object): if iscompare and auto_printarg: if self.appname == "virt-install": - if (not cli.count("--print-xml") and - not cli.count("--print-step") and - not cli.count("--quiet")): + if ("--print-xml" not in cli and + "--print-step" not in cli and + "--quiet" not in cli): args += " --print-step all" elif self.appname == "virt-clone": - if not cli.count("--print-xml"): + if "--print-xml" not in cli: args += " --print-xml" return args diff --git a/tests/test_urls.py b/tests/test_urls.py index 3f595a53..3864f776 100644 --- a/tests/test_urls.py +++ b/tests/test_urls.py @@ -118,7 +118,7 @@ def _storeForDistro(fetcher, guest): try: return urlfetcher.getDistroStore(guest, fetcher) except Exception as e: - if str(e).count("502"): + if "502" in str(e): logging.debug("Caught proxy error: %s", str(e)) time.sleep(.5) continue |