Skip to content
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

empty unit test csv fixture values default to null #10117

Merged
merged 2 commits into from
May 9, 2024

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented May 9, 2024

resolves #9881

Problem

CSV fixtures with empty values are converted to "" instead of null -- which is inconsistent with the way seeds work.

Solution

  • Convert csv fixture rows from "" to null (None in python, converted to null later down in the framework) if detected.
  • Added the normalization to unit test parsing in _validate_and_normalize_rows
  • Couldn't find a built-in way to handle this with csv.DictReader (https://stackoverflow.com/a/68305271)

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@cla-bot cla-bot bot added the cla:yes label May 9, 2024
Copy link
Contributor

github-actions bot commented May 9, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@@ -1822,7 +1822,7 @@ def code(self) -> str:
return "Z026"

def message(self) -> str:
return f" compiled Code at {self.path}"
return f" compiled code at {self.path}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small formatting issue, unrelated to the behaviour changes in this PR

cc @jtcohen6

Copy link

codecov bot commented May 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.19%. Comparing base (760e4ce) to head (74944d8).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10117      +/-   ##
==========================================
+ Coverage   88.16%   88.19%   +0.02%     
==========================================
  Files         181      181              
  Lines       22771    22788      +17     
==========================================
+ Hits        20077    20097      +20     
+ Misses       2694     2691       -3     
Flag Coverage Δ
integration 85.45% <100.00%> (-0.03%) ⬇️
unit 62.68% <25.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichelleArk MichelleArk marked this pull request as ready for review May 9, 2024 13:24
@MichelleArk MichelleArk requested a review from a team as a code owner May 9, 2024 13:24
@MichelleArk MichelleArk merged commit 55aad32 into main May 9, 2024
65 checks passed
@MichelleArk MichelleArk deleted the unit-test-csv-empty-to-null branch May 9, 2024 13:49
Copy link
Contributor

github-actions bot commented May 9, 2024

The backport to 1.8.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.8.latest 1.8.latest
# Navigate to the new working tree
cd .worktrees/backport-1.8.latest
# Create a new branch
git switch --create backport-10117-to-1.8.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 55aad328ea6878ca8bbc5dc53fb734b6142c0ec7
# Push it to GitHub
git push --set-upstream origin backport-10117-to-1.8.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.8.latest

Then, create a pull request where the base branch is 1.8.latest and the compare/head branch is backport-10117-to-1.8.latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit test fixture (csv) returns "" for empty value
3 participants