Stop doctests polluting current dir with temporary files
まだ誰も着手していません。
評価
調査の方向性
Start by reading the run-doctests tool and the doctests that create temporary netCDF files in the current directory; the issue does not name specific files or tests. Compare the proposed temporary-working-directory approach with a shared temporary-directory utility, keeping local-code imports and cleanup behavior in mind. Done means doctests no longer leave temporary netCDF files in the project directory without disrupting their execution.
索引モデルが issue の本文から書いたものです。
説明
At present, when you run any doctests temporary netCDF files are created in the current directory.
This is slightly tiresome, and could be avoided by dumping files to a temporary directory, like pytest does.
Unfortunately, adding specific code to do that in every module / docs-sourcefile could also be tiresome and intrusive.
in run-doctests
Possibly, a way to control this could be added to the run_doctests tool ?
- e.g., run by default in a temporary cwd -
- but that could affect doctest execution, and make some things difficult (e.g. importing local code) ??
using tempfile
instead of e.g. data.to_nc4('tmp.nc'),
import pathlib
import testfile
tempdir = pathlib.Path(testfile.TemporaryDirectory())
# ...
path = tempdir / "tmp.nc"
to_nc4(data, path)
result = from_nc4(path)
with a test utility
Or.. A utility to create a temp directory that will be consistently destroyed afterwards might be useful
(as opposed to tempdir which does not arrange for destruction).
# in <testutils.py>
import pathlib
class TempDir(pathlib.Path):
def __init__(self):
# self.context is deleted when self is deleted --> destroys directory
self.context = tempfile.TemporaryDirectory()
self.path_str = self.context.__enter__()
self.path = pathlib.Path(self.dirpath_str)
# a single common per-import object
tempdir = TempDir()
# ...
# in docstrings / docs
# Usage is generally shorter, and directory is removed on program exit
>>> from testutils import tempdir
...
>>> filepath = tempdir.path / "tmp.nc"
>>> to_nc4(data, filepath)
>>> result = from_nc4(filepath)
- 主要言語
- Python
- スター
- 16
- フォーク
- 6
- 平均マージ
- 2日 20時間
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SciTools/ncdata のほかの issue
-
Link Checker Reportオープンautomated issue report
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Fix homepage linkオープンscitools
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
-
Fix license controlオープンscitools
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
SciTools/ncdata の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
UKGovernmentBEIS/inspect_ai#6733 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ProyectoRespira/respira-webapp#334 ·
メンテナーはふだん 1 日以内に返信
-
bug security-alert
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
spectrayan/carefold#391 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Jakeschincariol/instagram-agent-skill#83 ·
メンテナーはふだん 10 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 64/100