Skip to content

Fix addFromConfig for processes with no output product - #79

Merged
dnadeau-lanl merged 1 commit into
spacepy:masterfrom
jtniehof:addfromconfig_no_output
Apr 16, 2021
Merged

dnadeau-lanl merged 1 commit into
spacepy:masterfrom
jtniehof:addfromconfig_no_output

Conversation

@jtniehof

Copy link
Copy Markdown
Member

addFromConfig no longer works for processes with no output product on Python 2.7. This is due to a comparison of empty strings with "is" in a situation where one might be in Unicode. This comparison has been around for awhile--I think it only became a problem when some of the config file handling was consolidated into a single place, and not explicitly cast to str in Python 2.

This PR changes to a simple equality comparison. It also adds a unit test to addFromConfig for the no-output case. It's worth noting the unit test does not catch the problem, as it's in the non-unit-tested (and not really easily testable) portion of addFromConfig. In lieu of that, I assert that the PSP config does not successfully load into a database with the previous addFromConfig, but does work with this PR.

Long-term we need to rearchitect addFromConfig to be more testable, but a story for another day.

PR Checklist

  • Pull request has descriptive title
  • Pull request gives overview of changes
  • (N/A) New code has inline comments where necessary
  • (N/A) Any new modules, functions or classes have docstrings consistent with dbprocessing style
  • (N/A) Major new functionality has appropriate Sphinx documentation
  • (N/A) Added an entry to release notes if fixing a major bug or providing a major new feature
  • (see above) New features and bug fixes should have unit tests
  • (N/A) Relevant issues are linked in the description (use Closes # if this PR closes the issue, or some other reference, such as See # if it is related in some other way)

@jtniehof
jtniehof requested a review from dnadeau-lanl April 15, 2021 19:44
@dnadeau-lanl
dnadeau-lanl merged commit 3aafa1e into spacepy:master Apr 16, 2021
@jtniehof
jtniehof deleted the addfromconfig_no_output branch April 16, 2021 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants