Skip to content

Commit

Permalink
bug fix for _rv occurring since Config inherited __rv__ attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
huard committed Mar 12, 2024
1 parent e1539a0 commit 251442d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ravenpy/config/rvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ class RVE(RV):


class Config(RVI, RVC, RVH, RVT, RVP, RVE):
__rv__ = None

def header(self, rv):
"""Return the header to print at the top of each RV file."""
import datetime as dt
Expand Down
5 changes: 4 additions & 1 deletion tests/test_rvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pymbolic.primitives import Variable

from ravenpy.config import commands as rc
from ravenpy.config import options
from ravenpy.config.rvs import RV, RVI, Config, optfield


Expand Down Expand Up @@ -133,12 +134,14 @@ class myRVI(RVI):
# Custom config with custom RVI
class MyConfig(myRVI, cls):
params: P = P()
enkf_mode: options.EnKFMode = optfield(alias="EnKFMode")

# Make sure rv files can be written
conf = MyConfig().set_params([0.5])
conf = MyConfig(EnKFMode="ENKF_SPINUP").set_params([0.5])
conf.write_rv(workdir=tmp_path)
assert conf.run_name == "myRunName"
assert "myRunName" in conf._rv("RVI")
assert "EnKFMode" not in conf._rv("RVI")


def test_hru_filter():
Expand Down

0 comments on commit 251442d

Please sign in to comment.