Skip to content

Commit

Permalink
adds Loader parameter to calls to yaml.load to avoid deprecation warn…
Browse files Browse the repository at this point in the history
…ing.

see also: croach#34

Signed-off-by: Martin Kloesch <[email protected]>
  • Loading branch information
kmhsonnenkind committed Apr 16, 2019
1 parent b34597d commit 70a3453
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions flask_fixtures/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ def dtparse(dtstring):
try:
import yaml
except ImportError:
def load(self, filename):
def load(self, filename, Loader=None):
raise Exception("Could not load fixture '{0}'. Make sure you have PyYAML installed.".format(filename))
yaml = type('FakeYaml', (object,), {
'load': load
'load': load,
'loader': type('FakeLoader', (object,), {'FullLoader': None})()
})()


Expand Down Expand Up @@ -74,7 +75,7 @@ class YAMLLoader(FixtureLoader):

def load(self, filename):
with open(filename) as fin:
return yaml.load(fin)
return yaml.load(fin, yaml.loader.FullLoader)


def load(filename):
Expand Down

0 comments on commit 70a3453

Please sign in to comment.