Skip to content

Commit

Permalink
Fix: pytest Wait 1 Sec
Browse files Browse the repository at this point in the history
Simetimes our tests are so quick that they
finish below 1second. That does not work with
`UniqueStrings` in AMReX' `UtilCreateCleanDirectory`,
which can only do one name per second:
https://github.com/AMReX-Codes/amrex/blob/23.08/Src/Base/AMReX_Utility.cpp#L186-L199

If the target exist, the behavior of `std::rename` is
implementation dependent. We see crashes of this
on macOS.
https://en.cppreference.com/w/cpp/io/c/rename
  • Loading branch information
ax3l committed Aug 28, 2023
1 parent d89f17e commit 594ee4e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/python/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

import time

import pytest

import amrex.space3d as amr
Expand Down Expand Up @@ -32,3 +34,8 @@ def amrex_init():
)
yield
amr.finalize()

# sleep 1s because AMReX diagnostics cleanup can only do one rename
# per second
# https://github.com/AMReX-Codes/amrex/blob/23.08/Src/Base/AMReX_Utility.cpp#L186-L199
time.sleep(1)

0 comments on commit 594ee4e

Please sign in to comment.