Skip to content

Commit

Permalink
Get rid of xfail for parameters duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
paulromano committed Feb 18, 2022
1 parent 9b5a5cd commit ad6c561
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from pathlib import Path
from datetime import datetime
import warnings

from astropy.units import Quantity, kilometer
import watts
Expand Down Expand Up @@ -117,17 +118,16 @@ def test_parameters_show_summary(capsys):
assert out == expected_out


@pytest.mark.xfail
def test_parameters_duplicates_xfail():
# By default, no warning is given so this test is expected to fail
# TODO: when pytest 7.0 is released, use pytest.does_not_warn()
def test_parameters_duplicates():
params = watts.Parameters(a=3)
with pytest.warns(UserWarning):
params['a'] = 8

# By default, overwriting a parameter shouldn't produce a warning. If a
# warning is given, the filter below will result in a test failure
with warnings.catch_warnings():
warnings.simplefilter('error')
params['a'] = 8

def test_parameters_duplicates():
params = watts.Parameters(a=3)
# In this case, we expect a warning to be produced
params.warn_duplicates = True
with pytest.warns(UserWarning):
params['a'] = 8
Expand Down

0 comments on commit ad6c561

Please sign in to comment.