-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sorting to the list of paths before storing them to the golden copy #56
Add sorting to the list of paths before storing them to the golden copy #56
Conversation
absolute path of a filespec.
the golden copies. With --update param, now the golden copies are updated only if: - The golden copy doesn't exists - The file paths are different than those in the golden copies. If a list of paths have the same paths but different order than ones in the golden copy, they will be considered the same. And we won't update the golden copy in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull has conflicts with the main branch that need to be resolved
pdsfile/pdsfile_test_helper.py
Outdated
with open(path, 'w') as f: | ||
pprint.pp(data, stream=f) | ||
print('\nCreate the golden copy', path) | ||
# If the update param is given, compare the file first to make sure we don't write |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to do this? If the output is sorted properly, writing a new output file with identical content is fine.
by 'group' and then 'prority' just like the original opus products outputs.
…esults_dictionary_before_storing_to_golden_copy
by 'group' and 'priority'.
pdsfile/pdsfile_test_helper.py
Outdated
import ast | ||
from collections import OrderedDict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to use OrderedDict
. Python 3 guarantees that the order of dictionary keys will stay the same. This was only needed for Python 2.
pdsfile/pdsfile_test_helper.py
Outdated
@@ -39,22 +40,41 @@ def read_or_update_golden_copy(data, path, update): | |||
""" | |||
|
|||
path = Path(path) | |||
# Create the golden copy by using the current output | |||
# Create the golden copy by using the current output if or the update param is given |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "if OR the update"
pdsfile/pdsfile_test_helper.py
Outdated
return read_file(path) | ||
|
||
def read_file(path): | ||
"""Return data from the read file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW if we're going to start putting docstrings in, we should make them in Google Docstyle format. Less work to do later to change them.
…e_storing_to_golden_copy
Updates:
--update
param, now the golden copies are updated only if: