[PATCH 1/3] iotests/testrunner.py: add doc string for run_test()

Vladimir Sementsov-Ogievskiy posted 3 patches 4 years, 2 months ago
Maintainers: Hanna Reitz <hreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
[PATCH 1/3] iotests/testrunner.py: add doc string for run_test()
Posted by Vladimir Sementsov-Ogievskiy 4 years, 2 months ago
We are going to modify these methods and will add more documentation in
further commit. As a preparation add basic documentation.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/testrunner.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index 0e29c2fddd..fa842252d3 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -220,6 +220,12 @@ def find_reference(self, test: str) -> str:
         return f'{test}.out'
 
     def do_run_test(self, test: str) -> TestResult:
+        """
+        Run one test
+
+        :param test: test file path
+        """
+
         f_test = Path(test)
         f_bad = Path(f_test.name + '.out.bad')
         f_notrun = Path(f_test.name + '.notrun')
@@ -287,6 +293,13 @@ def do_run_test(self, test: str) -> TestResult:
 
     def run_test(self, test: str,
                  test_field_width: Optional[int] = None) -> TestResult:
+        """
+        Run one test and print short status
+
+        :param test: test file path
+        :param test_field_width: width for first field of status format
+        """
+
         last_el = self.last_elapsed.get(test)
         start = datetime.datetime.now().strftime('%H:%M:%S')
 
-- 
2.31.1


Re: [PATCH 1/3] iotests/testrunner.py: add doc string for run_test()
Posted by John Snow 4 years, 2 months ago
On Fri, Dec 3, 2021 at 7:22 AM Vladimir Sementsov-Ogievskiy <
vsementsov@virtuozzo.com> wrote:

> We are going to modify these methods and will add more documentation in
> further commit. As a preparation add basic documentation.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  tests/qemu-iotests/testrunner.py | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/tests/qemu-iotests/testrunner.py
> b/tests/qemu-iotests/testrunner.py
> index 0e29c2fddd..fa842252d3 100644
> --- a/tests/qemu-iotests/testrunner.py
> +++ b/tests/qemu-iotests/testrunner.py
> @@ -220,6 +220,12 @@ def find_reference(self, test: str) -> str:
>          return f'{test}.out'
>
>      def do_run_test(self, test: str) -> TestResult:
> +        """
> +        Run one test
> +
> +        :param test: test file path
> +        """
> +
>          f_test = Path(test)
>          f_bad = Path(f_test.name + '.out.bad')
>          f_notrun = Path(f_test.name + '.notrun')
> @@ -287,6 +293,13 @@ def do_run_test(self, test: str) -> TestResult:
>
>      def run_test(self, test: str,
>                   test_field_width: Optional[int] = None) -> TestResult:
> +        """
> +        Run one test and print short status
> +
> +        :param test: test file path
> +        :param test_field_width: width for first field of status format
> +        """
> +
>          last_el = self.last_elapsed.get(test)
>          start = datetime.datetime.now().strftime('%H:%M:%S')
>
> --
> 2.31.1
>
>
Reviewed-by: John Snow <jsnow@redhat.com>
Re: [PATCH 1/3] iotests/testrunner.py: add doc string for run_test()
Posted by Kevin Wolf 4 years, 1 month ago
Am 03.12.2021 um 13:22 hat Vladimir Sementsov-Ogievskiy geschrieben:
> We are going to modify these methods and will add more documentation in
> further commit. As a preparation add basic documentation.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  tests/qemu-iotests/testrunner.py | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
> index 0e29c2fddd..fa842252d3 100644
> --- a/tests/qemu-iotests/testrunner.py
> +++ b/tests/qemu-iotests/testrunner.py
> @@ -220,6 +220,12 @@ def find_reference(self, test: str) -> str:
>          return f'{test}.out'
>  
>      def do_run_test(self, test: str) -> TestResult:
> +        """
> +        Run one test
> +
> +        :param test: test file path
> +        """
> +
>          f_test = Path(test)
>          f_bad = Path(f_test.name + '.out.bad')
>          f_notrun = Path(f_test.name + '.notrun')
> @@ -287,6 +293,13 @@ def do_run_test(self, test: str) -> TestResult:
>  
>      def run_test(self, test: str,
>                   test_field_width: Optional[int] = None) -> TestResult:
> +        """
> +        Run one test and print short status
> +
> +        :param test: test file path
> +        :param test_field_width: width for first field of status format
> +        """
> +
>          last_el = self.last_elapsed.get(test)
>          start = datetime.datetime.now().strftime('%H:%M:%S')

test_field_width is Optional[int], so the documentation should specify
what happens when you pass None.

Seems it doesn't change the behaviour, but just picks a default value of
8. 'test_field_width: int = 8' might have been the more obvious solution
for this in the first place.

Kevin


Re: [PATCH 1/3] iotests/testrunner.py: add doc string for run_test()
Posted by Vladimir Sementsov-Ogievskiy 4 years, 1 month ago
10.12.2021 17:12, Kevin Wolf wrote:
> Am 03.12.2021 um 13:22 hat Vladimir Sementsov-Ogievskiy geschrieben:
>> We are going to modify these methods and will add more documentation in
>> further commit. As a preparation add basic documentation.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>   tests/qemu-iotests/testrunner.py | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
>> index 0e29c2fddd..fa842252d3 100644
>> --- a/tests/qemu-iotests/testrunner.py
>> +++ b/tests/qemu-iotests/testrunner.py
>> @@ -220,6 +220,12 @@ def find_reference(self, test: str) -> str:
>>           return f'{test}.out'
>>   
>>       def do_run_test(self, test: str) -> TestResult:
>> +        """
>> +        Run one test
>> +
>> +        :param test: test file path
>> +        """
>> +
>>           f_test = Path(test)
>>           f_bad = Path(f_test.name + '.out.bad')
>>           f_notrun = Path(f_test.name + '.notrun')
>> @@ -287,6 +293,13 @@ def do_run_test(self, test: str) -> TestResult:
>>   
>>       def run_test(self, test: str,
>>                    test_field_width: Optional[int] = None) -> TestResult:
>> +        """
>> +        Run one test and print short status
>> +
>> +        :param test: test file path
>> +        :param test_field_width: width for first field of status format
>> +        """
>> +
>>           last_el = self.last_elapsed.get(test)
>>           start = datetime.datetime.now().strftime('%H:%M:%S')
> 
> test_field_width is Optional[int], so the documentation should specify
> what happens when you pass None.
> 
> Seems it doesn't change the behaviour, but just picks a default value of
> 8. 'test_field_width: int = 8' might have been the more obvious solution
> for this in the first place.
> 
> Kevin
> 

Agree, I'll make a follow-up patch for it.

-- 
Best regards,
Vladimir