diff mbox series

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

Message ID 20240711115546.40859-4-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series Convert avocado tests to normal Python unittests | expand

Commit Message

Thomas Huth July 11, 2024, 11:55 a.m. UTC
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%)

Comments

Daniel P. Berrangé July 12, 2024, 8:55 a.m. UTC | #1
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
diff mbox series

Patch

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',