git: 864ea9abfb98 - main - pytest: add an example test fetching test directory and ATF vars.

From: Alexander V. Chernikov <melifaro_at_FreeBSD.org>
Date: Wed, 25 Jan 2023 13:57:25 UTC
The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=864ea9abfb98493a157dc17be17c428080843bdd

commit 864ea9abfb98493a157dc17be17c428080843bdd
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-01-25 13:55:33 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-01-25 13:55:33 +0000

    pytest: add an example test fetching test directory and ATF vars.
    
    MFC after:      2 weeks
---
 tests/examples/test_examples.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/examples/test_examples.py b/tests/examples/test_examples.py
index 13fdcc420f0e..fe9ae0a72cf2 100644
--- a/tests/examples/test_examples.py
+++ b/tests/examples/test_examples.py
@@ -49,6 +49,16 @@ class TestExampleSimple(BaseTest):
     def test_two(self):
         pass
 
+    @pytest.mark.skip(reason="comment me to run the test")
+    def test_get_properties(self, request):
+        """Shows fetching of test src dir and ATF-set variables"""
+        print()
+        print("SRC_DIR={}".format(request.fspath.dirname))
+        print("ATF VARS:")
+        for k, v in self.atf_vars.items():
+            print("  {}: {}".format(k, v))
+        print()
+
     @pytest.mark.skip(reason="comment me to run the test")
     @pytest.mark.require_user("unprivileged")
     def test_syscall_failure(self):