Skip to content

Commit

Permalink
Make a copy of spec when resolving it
Browse files Browse the repository at this point in the history
If a specification has a base that can't be resolved, then an exception
is thrown in the resolve() method, indicating that it should be added to
a retry pile. But we're also modifying that specification in the
resolve_document() method. So when we actually do retry the resolution,
the specification may not be in a good state.

Doing a deep copy of the original specification in resolve_document()
solves all these things.
  • Loading branch information
jonathansick committed May 26, 2017
1 parent 894b16f commit d1e998b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/lsst/verify/specset.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from past.builtins import basestring

from collections import OrderedDict
import copy
import os
import re

Expand Down Expand Up @@ -720,6 +721,10 @@ def resolve_document(self, spec_doc):
Raised when a document's bases cannot be resolved (an inherited
`~lsst.validate.base.Specification` cannot be found in the repo).
"""
# Create a copy of the spec_doc so that if the resolution is aborted
# we haven't modified the original document
spec_doc = copy.deepcopy(spec_doc)

# Goal is to process all specifications and partials mentioned in
# the 'base' field (first in, first out) and merge their information
# to the spec_doc.
Expand Down

0 comments on commit d1e998b

Please sign in to comment.