agrc / forklift

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

fix: preserve metadata when creating destination #348

Closed stdavis closed 2 years ago

stdavis commented 2 years ago

Closes #347

Description of Changes

This pull request copies the source metadata to the destination when it is created.

We could update the metadata on each subsequent data update, but I worry that would lead to confusion. For example, if you update the metadata but not any features, maybe users would expect it to be shipped. It seems more explicite to say that if you want to update the metadata, delete the destination and it will be updates when it is recreated. However, I'm open to other ideas here.

Test results and coverage

============================================================================================================================= test session starts ==============================================================================================================================================================================================
platform win32 -- Python 3.7.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: W:\forklift, configfile: pytest.ini, testpaths: tests
plugins: instafail-0.4.2, requests-mock-1.8.0, cov-2.12.1, isort-2.0.0, pylint-0.18.0                                                                                                                                                                                          
collected 217 items
--------------------------------------------------------------------------------
Linting files
.................
--------------------------------------------------------------------------------
                                                                                                                                                                                                                                                                      [  2/217]
tests\__init__.py ..                                                                                                                                                                                                                                                  [  4/217]
                                                        [  2/217]                                                                                                                                                                                                     [  6/217]
tests\PalletWithSyntaxErrors.py ..                                                                                                                                                                                                                                    [  8/217]
                                                        [  4/217]                                                                                                                                                                                                     [ 10/217]
tests\SchemaLockPallet.py ..                                                                                                                                                                                                                                          [ 12/217]
                                                        [  6/217]                                                                                                                                                                                                     [ 31/217]
tests\benchmark_arcgis.py ..                                                                                                                                                                                                                                          [ 43/217]
                                                        [  8/217]                                                                                                                                                                                                     [ 51/217]
tests\conftest.py ..                                                                                                                                                                                                                                                  [ 59/217]
                                                        [ 10/217]
tests\mocks.py ..
                                                        [ 12/217]
tests\test_arcgis.py ...................
                                                        [ 31/217]
tests\test_change_detection.py ............
                                                        [ 43/217]
tests\test_changes.py ........
                                                        [ 51/217]
tests\test_config.py ........
                                                        [ 59/217]
tests\test_core.py ........................................
                                                        [ 99/217]
tests\test_crate.py .....................
                                                        [120/217]
tests\test_engine.py ........................s..........
                                                        [155/217]
tests\test_lift.py ...........
                                                        [166/217]
tests\test_messaging.py .......
                                                        [173/217]
tests\test_pallet.py ..................................
                                                        [207/217]
tests\test_seat.py ......
                                                        [213/217]
tests\test_slack.py ....
                                                        [217/217]

============================================================================================================================== warnings summary ===============================================================================================================================
c:\users\agrc-arcgis\appdata\local\esri\conda\envs\forklift\lib\site-packages\_pytest\config\__init__.py:1233
  c:\users\agrc-arcgis\appdata\local\esri\conda\envs\forklift\lib\site-packages\_pytest\config\__init__.py:1233: PytestConfigWarning: Unknown config option: log_print

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/warnings.html

---------- coverage: platform win32, python 3.7.10-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      62      5     16      2    91.03%   32-34, 51->52, 52, 54->55, 55
src\forklift\config.py                50      1     20      2    95.71%   83->84, 84, 119->118
src\forklift\core.py                 202      6     87      5    95.50%   97->100, 100, 129->130, 130, 153-154, 209->212, 272, 307->306, 433->434, 434
src\forklift\engine.py               479    172    160     12    61.50%   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, 667, 681->684, 684-693, 721->724, 724-725, 727->730, 730, 744-750, 756, 760->763, 763, 808->809, 809, 914-957
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             82     31     20      2    57.84%   55->56, 56, 64-76, 88-123, 142, 162->163, 163-169, 183-186
src\forklift\models.py               196      4     52      3    96.37%   96, 183->182, 404->407, 407, 451->459, 459-460
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                               1565    333    547     65    75.47%

3 files skipped due to complete coverage.

============================================================================================================ 216 passed, 1 skipped, 1 warning in 346.13s (0:05:46) ============================================================================================================

Speed test results

Speed Test Results
Dry Run: 2.18 minutes
Repeat: 75.48 seconds
stdavis commented 2 years ago

I installed this on the server today.