agrc / forklift

:tractor::package::sparkles: Slinging data all over the place :tractor::package::sparkles:
MIT License
28 stars 3 forks source link

Better schema checks between source and destination fields #326

Closed stdavis closed 4 years ago

stdavis commented 4 years ago

Description of Changes

This pull request fixes two bugs. The first was that forklift was not skipping shape length fields that had non-standard names. I came across this when I pointed a crate source at a SQL spatial dataset.

The second bug that this PR fixes is described in #277.

Test results and coverage

=========================================== test session starts ===========================================
platform win32 -- Python 3.6.9, pytest-4.6.5, py-1.8.0, pluggy-0.12.0
rootdir: W:\forklift, inifile: pytest.ini, testpaths: tests
plugins: cov-2.7.1, instafail-0.4.1.post0, isort-0.3.1, pylint-0.14.1
collected 211 items                                                                                        
-----------------------------------------------------------------
Linting files
.
-----------------------------------------------------------------

tests\__init__.py ss                                                                              [  2/211]
tests\PalletWithSyntaxErrors.py ss                                                                [  4/211]
tests\SchemaLockPallet.py ss                                                                      [  6/211]
tests\benchmark_arcgis.py ss                                                                      [  8/211]
tests\conftest.py ss                                                                              [ 10/211]
tests\mocks.py ss                                                                                 [ 12/211]
tests\test_arcgis.py ss.................                                                          [ 31/211]
tests\test_change_detection.py ss.......                                                          [ 40/211]
tests\test_changes.py ss......                                                                    [ 48/211]
tests\test_config.py ss......                                                                     [ 56/211]
tests\test_core.py .....................................                                          [ 93/211]
tests\test_crate.py ss...................                                                         [114/211]
tests\test_engine.py ss......................s..........                                          [149/211]
tests\test_lift.py ss.........                                                                    [160/211]
tests\test_messaging.py ss.....                                                                   [167/211]
tests\test_pallet.py ss................................                                           [201/211]
tests\test_seat.py ss....                                                                         [207/211]
tests\test_slack.py ss..                                                                          [211/211]

----------- coverage: platform win32, python 3.6.9-final-0 -----------
Name                               Stmts   Miss Branch BrPart     Cover   Missing
---------------------------------------------------------------------------------
src\forklift\arcgis.py               113     29     32      2    70.34%   26, 79-107, 137-138, 143, 146, 163, 178->181, 181, 197->198, 198-200, 222-224
src\forklift\change_detection.py      56      5     12      2    89.71%   31-33, 50->51, 51, 53->54, 54
src\forklift\config.py                50      1     20      2    95.71%   82->83, 83, 118->117
src\forklift\core.py                 197      7     84      4    94.66%   96->97, 97-100, 129->130, 130, 153-154, 301->300, 429->430, 430
src\forklift\engine.py               477    171    160     12    61.54%   133->136, 136, 155-156, 212, 224->225, 225, 237->238, 238-318, 322->368, 332->333, 333-335, 358-359, 397-468, 498, 508, 522-538, 543-556, 571->572, 572, 592, 610->611, 611, 624-627, 678->681, 681-690, 718->721, 721-722, 724->727, 727, 741-747, 753, 757->760, 760, 805->806, 806, 911-954
src\forklift\lift.py                 148     52     52      4    61.00%   34, 41->42, 42, 152->153, 153-156, 159->163, 163-164, 187-198, 233-254, 281, 284->285, 285, 292-295, 310-317, 346-357
src\forklift\messaging.py             53     10     16      1    72.46%   58, 78->79, 79, 100-112
src\forklift\models.py               194      7     54      3    95.16%   93, 180->179, 330-332, 397->400, 400, 442->450, 450-451
src\forklift\slack.py                211     33    102     33    75.72%   24->25, 25-27, 54->57, 57, 71->72, 72-77, 79->80, 80-85, 90->93, 100->101, 101, 102->103, 103, 104->105, 105, 111->114, 116->117, 117-118, 120->87, 134->137, 137, 151->184, 155->158, 160->161, 161-164, 165->168, 168->171, 174->177, 189->192, 195->197, 197->200, 202->205, 236, 259->260, 260, 265, 276->278, 278->279, 279, 284->287, 287->288, 288, 304->305, 305, 331->332, 332, 333->334, 334, 347->348, 348, 351->354, 354->357, 360, 372, 375
---------------------------------------------------------------------------------
TOTAL                               1521    315    538     63    75.81%

3 files skipped due to complete coverage.

================================ 176 passed, 35 skipped in 2181.91 seconds ================================

Speed test results

Speed Test Results
Dry Run: 8.64 minutes
Repeat: 5.08 minutes
steveoh commented 4 years ago

What do you think about zipping the gdb so there aren't so many files? I know we talked about this before and I thought we liked the idea.

stdavis commented 4 years ago

I remembered that idea. I wonder if we should make it into a separate python project. Something that could automatically zip and unzip data that's pip-installable. Maybe a plugin to pytest.

steveoh commented 4 years ago

That sounds like a good goal. Should we start simple and prototype something in the before and after test events?

stdavis commented 4 years ago

Made some progress on this today. Not ready to commit yet, but close.

stdavis commented 4 years ago

Just waiting for tests. Be back in a few hours and I'll update how they went.