diff mbox series

[02/13] iotests/297: Split mypy configuration out into mypy.ini

Message ID 20211004210503.1455391-3-jsnow@redhat.com (mailing list archive)
State New, archived
Headers show
Series python/iotests: Run iotest linters during Python CI | expand

Commit Message

John Snow Oct. 4, 2021, 9:04 p.m. UTC
More separation of code and configuration.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 tests/qemu-iotests/297      | 14 +-------------
 tests/qemu-iotests/mypy.ini | 12 ++++++++++++
 2 files changed, 13 insertions(+), 13 deletions(-)
 create mode 100644 tests/qemu-iotests/mypy.ini

Comments

Hanna Czenczek Oct. 13, 2021, 10:53 a.m. UTC | #1
On 04.10.21 23:04, John Snow wrote:
> More separation of code and configuration.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>   tests/qemu-iotests/297      | 14 +-------------
>   tests/qemu-iotests/mypy.ini | 12 ++++++++++++
>   2 files changed, 13 insertions(+), 13 deletions(-)
>   create mode 100644 tests/qemu-iotests/mypy.ini

Reviewed-by: Hanna Reitz <hreitz@redhat.com>

> diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297
> index bc3a0ceb2aa..b8101e6024a 100755
> --- a/tests/qemu-iotests/297
> +++ b/tests/qemu-iotests/297
> @@ -73,19 +73,7 @@ def run_linters():
>       sys.stdout.flush()
>   
>       env['MYPYPATH'] = env['PYTHONPATH']
> -    p = subprocess.run(('mypy',
> -                        '--warn-unused-configs',
> -                        '--disallow-subclassing-any',
> -                        '--disallow-any-generics',
> -                        '--disallow-incomplete-defs',
> -                        '--disallow-untyped-decorators',
> -                        '--no-implicit-optional',
> -                        '--warn-redundant-casts',
> -                        '--warn-unused-ignores',
> -                        '--no-implicit-reexport',
> -                        '--namespace-packages',
> -                        '--scripts-are-modules',
> -                        *files),
> +    p = subprocess.run(('mypy', *files),
>                          env=env,
>                          check=False,
>                          stdout=subprocess.PIPE,
> diff --git a/tests/qemu-iotests/mypy.ini b/tests/qemu-iotests/mypy.ini
> new file mode 100644
> index 00000000000..4c0339f5589
> --- /dev/null
> +++ b/tests/qemu-iotests/mypy.ini
> @@ -0,0 +1,12 @@
> +[mypy]
> +disallow_any_generics = True
> +disallow_incomplete_defs = True
> +disallow_subclassing_any = True
> +disallow_untyped_decorators = True
> +implicit_reexport = False

Out of curiosity: Any reason you chose to invert this one, but none of 
the rest?  (i.e. no_implicit_optional = True -> implicit_optional = 
False; or disallow* = True -> allow* = False)

Hanna

> +namespace_packages = True
> +no_implicit_optional = True
> +scripts_are_modules = True
> +warn_redundant_casts = True
> +warn_unused_configs = True
> +warn_unused_ignores = True
John Snow Oct. 13, 2021, 2:37 p.m. UTC | #2
On Wed, Oct 13, 2021 at 6:53 AM Hanna Reitz <hreitz@redhat.com> wrote:

> On 04.10.21 23:04, John Snow wrote:
> > More separation of code and configuration.
> >
> > Signed-off-by: John Snow <jsnow@redhat.com>
> > ---
> >   tests/qemu-iotests/297      | 14 +-------------
> >   tests/qemu-iotests/mypy.ini | 12 ++++++++++++
> >   2 files changed, 13 insertions(+), 13 deletions(-)
> >   create mode 100644 tests/qemu-iotests/mypy.ini
>
> Reviewed-by: Hanna Reitz <hreitz@redhat.com>
>
> > diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297
> > index bc3a0ceb2aa..b8101e6024a 100755
> > --- a/tests/qemu-iotests/297
> > +++ b/tests/qemu-iotests/297
> > @@ -73,19 +73,7 @@ def run_linters():
> >       sys.stdout.flush()
> >
> >       env['MYPYPATH'] = env['PYTHONPATH']
> > -    p = subprocess.run(('mypy',
> > -                        '--warn-unused-configs',
> > -                        '--disallow-subclassing-any',
> > -                        '--disallow-any-generics',
> > -                        '--disallow-incomplete-defs',
> > -                        '--disallow-untyped-decorators',
> > -                        '--no-implicit-optional',
> > -                        '--warn-redundant-casts',
> > -                        '--warn-unused-ignores',
> > -                        '--no-implicit-reexport',
> > -                        '--namespace-packages',
> > -                        '--scripts-are-modules',
> > -                        *files),
> > +    p = subprocess.run(('mypy', *files),
> >                          env=env,
> >                          check=False,
> >                          stdout=subprocess.PIPE,
> > diff --git a/tests/qemu-iotests/mypy.ini b/tests/qemu-iotests/mypy.ini
> > new file mode 100644
> > index 00000000000..4c0339f5589
> > --- /dev/null
> > +++ b/tests/qemu-iotests/mypy.ini
> > @@ -0,0 +1,12 @@
> > +[mypy]
> > +disallow_any_generics = True
> > +disallow_incomplete_defs = True
> > +disallow_subclassing_any = True
> > +disallow_untyped_decorators = True
> > +implicit_reexport = False
>
> Out of curiosity: Any reason you chose to invert this one, but none of
> the rest?  (i.e. no_implicit_optional = True -> implicit_optional =
> False; or disallow* = True -> allow* = False)
>
>
Anything written as '--no-xxx' I wrote as 'xxx = False', but
"implicit_optional = False" isn't a supported option, so that one kept the
"no" in it.

--js
diff mbox series

Patch

diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297
index bc3a0ceb2aa..b8101e6024a 100755
--- a/tests/qemu-iotests/297
+++ b/tests/qemu-iotests/297
@@ -73,19 +73,7 @@  def run_linters():
     sys.stdout.flush()
 
     env['MYPYPATH'] = env['PYTHONPATH']
-    p = subprocess.run(('mypy',
-                        '--warn-unused-configs',
-                        '--disallow-subclassing-any',
-                        '--disallow-any-generics',
-                        '--disallow-incomplete-defs',
-                        '--disallow-untyped-decorators',
-                        '--no-implicit-optional',
-                        '--warn-redundant-casts',
-                        '--warn-unused-ignores',
-                        '--no-implicit-reexport',
-                        '--namespace-packages',
-                        '--scripts-are-modules',
-                        *files),
+    p = subprocess.run(('mypy', *files),
                        env=env,
                        check=False,
                        stdout=subprocess.PIPE,
diff --git a/tests/qemu-iotests/mypy.ini b/tests/qemu-iotests/mypy.ini
new file mode 100644
index 00000000000..4c0339f5589
--- /dev/null
+++ b/tests/qemu-iotests/mypy.ini
@@ -0,0 +1,12 @@ 
+[mypy]
+disallow_any_generics = True
+disallow_incomplete_defs = True
+disallow_subclassing_any = True
+disallow_untyped_decorators = True
+implicit_reexport = False
+namespace_packages = True
+no_implicit_optional = True
+scripts_are_modules = True
+warn_redundant_casts = True
+warn_unused_configs = True
+warn_unused_ignores = True