[GRASS-git] [OSGeo/grass] dc27b2: grass.gunittest: Fix SIM115 using context managers...

Edouard Choinière noreply at github.com
Wed Sep 18 16:06:30 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: dc27b28b4142504ac69a4a17cd4a1673ebbdbf4b
      https://github.com/OSGeo/grass/commit/dc27b28b4142504ac69a4a17cd4a1673ebbdbf4b
  Author: Edouard Choinière <27212526+echoix at users.noreply.github.com>
  Date:   2024-09-18 (Wed, 18 Sep 2024)

  Changed paths:
    M pyproject.toml
    M python/grass/gunittest/case.py
    M python/grass/gunittest/multireport.py
    M python/grass/gunittest/reporters.py

  Log Message:
  -----------
  grass.gunittest: Fix SIM115 using context managers to open files (#4338)

* grass.gunittest: Use a context manager for opening htmldiff_file

* grass.gunittest: Specify encoding for writing htmldiff_file

* grass.gunittest: Write all lines of htmldiff_file at once

* grass.gunittest: Use Path.write_text() to write htmldiff_file

* grass.gunittest: Use a context manager for opening actual and reference files (SIM115)

* grass.gunittest: Use a context manager for output StringIO in case.py

* grass.gunittest: Use a context manager for opening files (SIM115)

In function replace_in_file of reporters.py

* grass.gunittest: Use a context manager for opening files (SIM115)

In function wrap_stdstream_to_html of reporters.py

* grass.gunittest: Use a context manager for opening files (SIM115)

In function report_for_dirs of reporters.py. Reordered so string creation ends up together outside the context manger where the file is written.

* grass.gunittest: Use a context manager for opening files (SIM115)

In function end_file_test of class GrassTestFilesHtmlReporter of reporters.py. Reordered so string creation ends up together outside the context manger where the strings are written to the file.

* grass.gunittest: Use a context manager for opening files (SIM115)

In function report_for_dir of class TestsuiteDirReporter of reporters.py

* grass.gunittest: Ignore remaining two SIM115 in reporters.py

* grass.gunittest: Use a context manager for opening files in multireport (SIM115)

* style: Enable checking of SIM115



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list