[RFC PATCH 3/8] tests/pytest: Convert info_usernet and version test with small adjustments

Thomas Huth posted 8 patches 4 months, 2 weeks ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Thomas Huth <thuth@redhat.com>
There is a newer version of this series
[RFC PATCH 3/8] tests/pytest: Convert info_usernet and version test with small adjustments
Posted by Thomas Huth 4 months, 2 weeks ago
These two simple tests can be converted to a pytest quite easily,
we just have to set the machine to 'none' now manually since we
don't support the avocado tags here yet.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .../info_usernet.py => pytest/test_info_usernet.py}       | 6 ++----
 tests/{avocado/version.py => pytest/test_version.py}      | 8 +++-----
 2 files changed, 5 insertions(+), 9 deletions(-)
 rename tests/{avocado/info_usernet.py => pytest/test_info_usernet.py} (91%)
 rename tests/{avocado/version.py => pytest/test_version.py} (82%)

diff --git a/tests/avocado/info_usernet.py b/tests/pytest/test_info_usernet.py
similarity index 91%
rename from tests/avocado/info_usernet.py
rename to tests/pytest/test_info_usernet.py
index e1aa7a6e0a..0cc3697c0b 100644
--- a/tests/avocado/info_usernet.py
+++ b/tests/pytest/test_info_usernet.py
@@ -8,18 +8,16 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
 
-from avocado_qemu import QemuSystemTest
+from qemu_pytest import QemuSystemTest
 
 from qemu.utils import get_info_usernet_hostfwd_port
 
 
 class InfoUsernet(QemuSystemTest):
-    """
-    :avocado: tags=machine:none
-    """
 
     def test_hostfwd(self):
         self.require_netdev('user')
+        self.machine = 'none'
         self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22')
         self.vm.launch()
         res = self.vm.cmd('human-monitor-command',
diff --git a/tests/avocado/version.py b/tests/pytest/test_version.py
similarity index 82%
rename from tests/avocado/version.py
rename to tests/pytest/test_version.py
index c6139568a1..2d16b4075d 100644
--- a/tests/avocado/version.py
+++ b/tests/pytest/test_version.py
@@ -9,15 +9,13 @@
 # later.  See the COPYING file in the top-level directory.
 
 
-from avocado_qemu import QemuSystemTest
+from qemu_pytest import QemuSystemTest
 
 
 class Version(QemuSystemTest):
-    """
-    :avocado: tags=quick
-    :avocado: tags=machine:none
-    """
+
     def test_qmp_human_info_version(self):
+        self.machine = 'none'
         self.vm.add_args('-nodefaults')
         self.vm.launch()
         res = self.vm.cmd('human-monitor-command',
-- 
2.45.2
Re: [RFC PATCH 3/8] tests/pytest: Convert info_usernet and version test with small adjustments
Posted by Daniel P. Berrangé 4 months, 2 weeks ago
On Thu, Jul 11, 2024 at 01:55:41PM +0200, Thomas Huth wrote:
> These two simple tests can be converted to a pytest quite easily,
> we just have to set the machine to 'none' now manually since we
> don't support the avocado tags here yet.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  .../info_usernet.py => pytest/test_info_usernet.py}       | 6 ++----
>  tests/{avocado/version.py => pytest/test_version.py}      | 8 +++-----
>  2 files changed, 5 insertions(+), 9 deletions(-)
>  rename tests/{avocado/info_usernet.py => pytest/test_info_usernet.py} (91%)
>  rename tests/{avocado/version.py => pytest/test_version.py} (82%)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


> diff --git a/tests/avocado/version.py b/tests/pytest/test_version.py
> similarity index 82%
> rename from tests/avocado/version.py
> rename to tests/pytest/test_version.py
> index c6139568a1..2d16b4075d 100644
> --- a/tests/avocado/version.py
> +++ b/tests/pytest/test_version.py
> @@ -9,15 +9,13 @@
>  # later.  See the COPYING file in the top-level directory.
>  
>  
> -from avocado_qemu import QemuSystemTest
> +from qemu_pytest import QemuSystemTest
>  
>  
>  class Version(QemuSystemTest):
> -    """
> -    :avocado: tags=quick

I was going to suggest we expose 'quick' in the meson.build a suite,
but it seems we've barely used this tag, only 2 other examples, so
its pointless.

> -    :avocado: tags=machine:none
> -    """
> +
>      def test_qmp_human_info_version(self):
> +        self.machine = 'none'
>          self.vm.add_args('-nodefaults')
>          self.vm.launch()
>          res = self.vm.cmd('human-monitor-command',
> -- 
> 2.45.2
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|