Я использую пакет Atom build , и я хочу сопоставить ошибки из вывода pytest (библиотека тестирования Python). Я хочу добиться, чтобы редактор Atom переместился к файлу и строке неудачного теста (в приведенном ниже примере это plotting/solver_test.py, line 63
). К сожалению, следующее регулярное выражение, которое я написал, не работает:
errorMatch:
- .?(?<file>[\\/0-9a-zA-Z\\._]+):(?<line>\d+):\sAssertionError.*
Как я могу заставить его работать? Вот вывод формы pytest:
============================= test session starts ==============================
platform darwin -- Python 3.7.1, pytest-4.6.2, py-1.8.0, pluggy-0.12.0
rootdir: /Users/evgenii/Google Drive/Monash/ASP3012_stars/Assignments/Assignment2/LaTeX/code
collected 2 items
plotting/solver_test.py .F [100%]
=================================== FAILURES ===================================
_____________________________ test_calculate_orbit _____________________________
def test_calculate_orbit():
result = calculate_orbit(
tmax=10 * np.pi, nt=3142,
core_radius=0.2,
flattening_parameter=0.8,
v0=1,
initial_position=(1, 0, 0),
initial_velocity=(0, 0.9805806756909201, 0))
(times, positions, velocities, energies, angular_momenta) = result
# times
# -------
times = times.tolist()
assert len(times) == 3142
assert times[0] == 0
> assert times[1] == approx(0.01000188683, rel=1e-10)
E assert 0.0 == 0.01000188683 ± 1.0e-12
E + where 0.01000188683 ± 1.0e-12 = approx(0.01000188683, rel=1e-10)
plotting/solver_test.py:63: AssertionError
====================== 1 failed, 1 passed in 0.31 seconds ======================
Severity Provider Description Line