Monte Carlo test fixtures write their logs into the working directory
Maintainer thường phản hồi trong vòng 3 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu với tests/fixtures/monte_carlo/monte_carlo_fixtures.py và tests/unit/simulation/test_monte_carlo_plots_background.py, nơi issue cho biết các tên tệp tương đối được truyền vào; so sánh với phần dọn dẹp trong tests/integration/simulation/test_monte_carlo.py. Chạy pytest tests/unit/simulation -q và kiểm tra git status --porcelain; hoàn tất nghĩa là lần chạy kiểm thử không để lại tệp được tạo ra nào trong thư mục làm việc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
The Monte Carlo test fixtures pass a bare filename, so the logs land in whatever directory pytest was started from. Running the unit tests leaves three untracked files in the repository root, and nothing is ignoring them.
To Reproduce
On a clean develop:
$ git status --porcelain # nothing
$ pytest tests/unit/simulation -q
197 passed, 5 skipped
$ git status --porcelain
?? monte_carlo_test.errors.txt
?? monte_carlo_test.inputs.txt
?? monte_carlo_test.outputs.txt
All three are zero bytes, so they come from the files being opened rather than from anything being written.
Expected behavior
The suite leaves the working tree as it found it.
Additional context
The name comes from the shared fixture:
# tests/fixtures/monte_carlo/monte_carlo_fixtures.py
return MonteCarlo(
filename="monte_carlo_test",
...
)
That is relative, so it resolves against the current working directory. It appears in three places: twice in that fixture and once in tests/unit/simulation/test_monte_carlo_plots_background.py.
There is already a workaround for this in the tree, which is what made me look. tests/integration/simulation/test_monte_carlo.py carries a helper that removes the files by name:
def _post_test_file_cleanup():
"""Clean monte carlo files after test session if they exist."""
files_to_cleanup = [
"monte_carlo_class_example.kml",
"monte_carlo_test.errors.txt",
...
It is called from finally blocks in the integration tests, so it does not run for a unit-only invocation, which is why those runs leave the files behind. Its list also names a .kml and three .png, so more than the Monte Carlo logs are being written to the working directory.
Two ways to go, and I do not have a preference strong enough to argue for one:
- point the fixtures at
tmp_path, which removes the need for the cleanup helper as well; - or add the names to
.gitignore, which hides them without stopping them.
The first is the one that would let the helper go away. Happy to open a pull request if that is the direction, though it touches fixtures several tests share, so it seemed worth asking first.
Not urgent. It is a papercut, but an untracked file in the root is easy to sweep into an unrelated commit.
- Ngôn ngữ chính
- Python
- Star
- 1.1k
- Fork
- 280
- Merge trung bình
- 3 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 24
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của RocketPy-Team/RocketPy
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
RocketPy-Team/RocketPy#1255 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
RocketPy-Team/RocketPy#1241 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
RocketPy-Team/RocketPy#1202 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
RocketPy-Team/RocketPy#1171 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 56/100
RocketPy-Team/RocketPy#1251 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của RocketPy-Team/RocketPy
Issue tương tự
-
docs(contributing): the two things that silently block a PRCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởavailable documentation good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 95/100
Nixitov/Riptide-Native#944 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
JTHCode/secretguard#24 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: middleware documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainer thường phản hồi trong vòng 1 ngày