-
Notifications
You must be signed in to change notification settings - Fork 4
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
Drop overly-complected Christmas tree tests #145
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
93.6700 | ||
93.1600 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,7 @@ | |
from records_mover.records.load_plan import RecordsLoadPlan | ||
from records_mover.records.processing_instructions import ProcessingInstructions | ||
from records_mover.db.vertica.records_import_options import vertica_import_options | ||
from ...records.format_hints import christmas_tree_format_1_hints | ||
from records_mover.records.delimited.utils import logger as driver_logger | ||
import unittest | ||
from mock import call, patch | ||
|
||
|
||
class TestVerticaImportOptions(unittest.TestCase): | ||
|
@@ -87,34 +84,6 @@ def test_vertica_format_permissive(self): | |
self.assertDictEqual(options, expected_options) | ||
self.assertEqual(unhandled_hints, set()) | ||
|
||
def test_christmas_tree_format_1_permissive(self): | ||
vertica_format = DelimitedRecordsFormat(variant='dumb', hints=christmas_tree_format_1_hints) | ||
processing_instructions = ProcessingInstructions(fail_if_cant_handle_hint=False) | ||
load_plan = RecordsLoadPlan(processing_instructions=processing_instructions, | ||
records_format=vertica_format) | ||
unhandled_hints = set(load_plan.records_format.hints.keys()) | ||
with patch.object(driver_logger, 'warning') as mock_warning: | ||
options = vertica_import_options(unhandled_hints, load_plan) | ||
expected_options = { | ||
'abort_on_error': True, | ||
'delimiter': '\x01', | ||
'enforcelength': True, | ||
'error_tolerance': False, | ||
'escape_as': '\\', | ||
'load_method': 'AUTO', | ||
'no_commit': False, | ||
'null_as': None, | ||
'record_terminator': '\x02', | ||
'rejectmax': 1, | ||
'skip': 1, | ||
'trailing_nullcols': False, | ||
} | ||
self.assertDictEqual(options, expected_options) | ||
self.assertListEqual(mock_warning.mock_calls, | ||
[call("Ignoring hint compression = 'LZO'"), | ||
call("Ignoring hint quoting = 'nonnumeric'")]) | ||
self.assertEqual(unhandled_hints, set()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests try to validate things by a growing collection of eclectic hints which try to test a number of different things simultaneously. Cool, I guess, but the downside is that debugging them when they fail is really hard and creates cognitive load. Instead I'd like to test hints more individually - the tests in #144 and #140 are better examples of how I'd like to write these tests going forward. I've been wanting to kill these for a while, but the forcing function was that I tried to debug these after making clearly safe changes and it gave me too much of a head-ache trying to detangle what was going on. |
||
|
||
def test_weird_timeonlyformat(self): | ||
vertica_format = DelimitedRecordsFormat(variant='dumb', hints={ | ||
'timeonlyformat': 'something else' | ||
|
This file was deleted.
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 is the downside. I'll make up for some of that in #140, for sure, but won't have time to get us back to this number.
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.
I do think that the complexity-reduction here is an overall benefit.