-
Notifications
You must be signed in to change notification settings - Fork 126
test: Added more unit tests for CLI options #1421
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
base: develop
Are you sure you want to change the base?
Conversation
/gcbrun |
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.
Thanks a lot for your contribution @safe049! I did an overall review since I'm not very acquainted with the CLI unit tests, hopefully @nj1973 or @sundar-mudupalli-work could review them in more technical detail.
But seeing how early our Cloud Build check failed, you probably still need to lint & format your files and you can use our script ./tests/local_check.sh
for that. Let me know if you need help!
…unit tests in main and cli_tools
I removed those buggy function and a useless import, I think it will be alright now |
/gcbrun |
I don't have enough context to evaluate the specific CLI unit tests, I'll be assigning to other team member
/gcbrun |
any progress? |
/gcbrun |
@nj1973 @sundar-mudupalli-work - Could you please take some time when you can to review this PR? Thank you! |
/gemini review |
Dear Dysprosium,
mocks get_parsed_args and returns the value for source_conn specified. The assertion checks that the value passed in is what was received. No DVT code is tested by this function and these tests are not needed. Once the above mentioned changes are made, we can integrate your code in the test suite. We understand that reviewing feedback can be a process, and we're here to help you through it. Please don't hesitate to ask any questions you may have. Sundar Mudupalli |
I have deleted all those useless crap functions and fixed the type and the test_successful_schema_validation_with_mocked_run_validation,but for some how my coverage test is getting these error,i don't think they're problems of the code,i should got a version issue ERROR: Coverage failure: total of 6 is less than fail-under=70
/home/dynamo/miniconda3/envs/google/lib/python3.12/site-packages/pytest_cov/plugin.py:355: CovFailUnderWarning: Coverage failure: total of 6 is less than fail-under=70
warnings.warn(CovFailUnderWarning(message), stacklevel=1)
================================================================================================== ERRORS ==================================================================================================
________________________________________________________________________ ERROR collecting tests/unit/ibis_addon/test_operations.py _________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/ibis_addon/test_operations.py:14: in <module>
import ibis
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
________________________________________________________________________________ ERROR collecting tests/unit/test__main.py _________________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test__main.py:21: in <module>
from data_validation import cli_tools, exceptions, config_manager, consts
data_validation/cli_tools.py:58: in <module>
from data_validation import (
data_validation/clients.py:25: in <module>
import ibis
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
______________________________________________________________________________ ERROR collecting tests/unit/test_cli_tools.py _______________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test_cli_tools.py:24: in <module>
from data_validation import cli_tools, consts, gcs_helper
data_validation/cli_tools.py:58: in <module>
from data_validation import (
data_validation/clients.py:25: in <module>
import ibis
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
_______________________________________________________________________________ ERROR collecting tests/unit/test_clients.py ________________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test_clients.py:20: in <module>
import ibis.backends.pandas
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
_______________________________________________________________________________ ERROR collecting tests/unit/test_combiner.py _______________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test_combiner.py:16: in <module>
import ibis.backends.pandas
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
____________________________________________________________________________ ERROR collecting tests/unit/test_config_manager.py ____________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test_config_manager.py:18: in <module>
import ibis.expr.datatypes as dt
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
___________________________________________________________________________ ERROR collecting tests/unit/test_data_validation.py ____________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test_data_validation.py:24: in <module>
import ibis.expr.datatypes as dt
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
__________________________________________________________________________ ERROR collecting tests/unit/test_partition_builder.py ___________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test_partition_builder.py:23: in <module>
from data_validation import cli_tools
data_validation/cli_tools.py:58: in <module>
from data_validation import (
data_validation/clients.py:25: in <module>
import ibis
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
__________________________________________________________________________ ERROR collecting tests/unit/test_schema_validation.py ___________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test_schema_validation.py:20: in <module>
from data_validation import consts, data_validation
data_validation/data_validation.py:19: in <module>
import ibis.backends.pandas
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
__________________________________________________________________________ ERROR collecting tests/unit/test_validation_builder.py __________________________________________________________________________
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:457: in memof
return cache[k]
E KeyError: (('Optional[str]', 'ibis.examples'), None)
During handling of the above exception, another exception occurred:
tests/unit/test_validation_builder.py:21: in <module>
from data_validation.config_manager import ConfigManager
data_validation/config_manager.py:22: in <module>
import ibis.expr.datatypes as dt
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/__init__.py:6: in <module>
from ibis import examples, util
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/examples/__init__.py:35: in <module>
class Example(Concrete):
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/grounds.py:54: in __new__
typehint = evaluate_typehint(typehint, module)
../../miniconda3/envs/google/lib/python3.12/site-packages/toolz/functoolz.py:461: in memof
cache[k] = result = func(*args, **kwargs)
../../miniconda3/envs/google/lib/python3.12/site-packages/ibis/common/typing.py:30: in evaluate_typehint
return hint._evaluate(globalns, locals(), frozenset())
E TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
============================================================================================= warnings summary =============================================================================================
data_validation/__init__.py:15
/home/dynamo/projects/professional-services-data-validator/data_validation/__init__.py:15: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
from pkg_resources import get_distribution
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---------- coverage: platform linux, python 3.12.9-final-0 -----------
Name Stmts Miss Branch BrPart Cover Missing
----------------------------------------------------------------------------------------------------
data_validation/__init__.py 3 0 0 0 100%
data_validation/__main__.py 269 269 128 0 0% 15-713
data_validation/app.py 40 40 8 0 0% 15-76
data_validation/cli_tools.py 489 477 134 0 2% 66-1612
data_validation/client_info.py 6 1 0 0 83% 25
data_validation/clients.py 172 163 52 0 4% 26-371
data_validation/combiner.py 123 123 38 0 0% 21-502
data_validation/config_manager.py 549 542 182 0 1% 23-1303
data_validation/consts.py 122 0 0 0 100%
data_validation/data_validation.py 142 137 48 0 3% 20-413
data_validation/exceptions.py 6 6 0 0 0% 16-25
data_validation/find_tables.py 42 42 12 0 0% 16-157
data_validation/gcs_helper.py 63 45 16 0 23% 28, 33-35, 40-46, 54, 58-62, 66-68, 73-75, 79-83, 87-95, 100-109, 113-119
data_validation/jellyfish_distance.py 10 10 4 0 0% 15-35
data_validation/metadata.py 36 36 8 0 0% 17-71
data_validation/partition_builder.py 132 132 42 0 0% 15-430
data_validation/query_builder/__init__.py 0 0 0 0 100%
data_validation/query_builder/partition_row_builder.py 16 16 2 0 0% 15-71
data_validation/query_builder/query_builder.py 242 242 52 0 0% 15-607
data_validation/query_builder/random_row_builder.py 28 28 4 0 0% 14-104
data_validation/raw_query.py 31 31 12 0 0% 15-74
data_validation/result_handlers/__init__.py 0 0 0 0 100%
data_validation/result_handlers/bigquery.py 32 32 12 0 0% 17-124
data_validation/result_handlers/text.py 32 32 12 0 0% 24-87
data_validation/schema_validation.py 167 167 66 0 0% 15-400
data_validation/secret_manager.py 18 18 2 0 0% 15-62
data_validation/state_manager.py 59 37 14 0 30% 43-51, 60-61, 69-70, 80-83, 93-97, 101-102, 110-113, 121, 126-129, 132-135, 138-142, 145-148
data_validation/util.py 26 26 6 0 0% 15-62
data_validation/validation_builder.py 188 188 34 0 0% 14-427
tests/unit/__init__.py 0 0 0 0 100%
tests/unit/ibis_addon/__init__.py 0 0 0 0 100%
tests/unit/ibis_addon/test_operations.py 25 24 0 0 4% 15-83
tests/unit/query_builder/__init__.py 0 0 0 0 100%
tests/unit/query_builder/test_random_row_builder.py 12 7 0 0 42% 20-22, 26, 30-34
tests/unit/result_handlers/__init__.py 0 0 0 0 100%
tests/unit/result_handlers/test_bigquery.py 14 8 0 0 43% 23-25, 29-36
tests/unit/result_handlers/test_text.py 52 35 2 0 31% 53-55, 60, 65-72, 77-84, 89-97, 102-121, 136-147
tests/unit/test__main.py 159 153 0 0 4% 22-607
tests/unit/test_cli_tools.py 303 295 4 0 3% 26-990
tests/unit/test_clients.py 42 37 0 0 12% 21-95
tests/unit/test_combiner.py 64 62 0 0 3% 17-1103
tests/unit/test_config_manager.py 226 222 2 0 2% 20-667
tests/unit/test_data_validation.py 301 292 4 0 3% 26-892
tests/unit/test_find_tables.py 21 7 0 0 67% 54-56, 61-65, 153-160
tests/unit/test_metadata.py 23 14 0 0 39% 20-22, 37-41, 45-49, 89-103, 107-111
tests/unit/test_partition_builder.py 117 109 6 0 7% 24-713
tests/unit/test_raw_query.py 32 17 0 0 47% 26-28, 51-54, 69-71, 91-93, 118-119, 136-140
tests/unit/test_schema_validation.py 93 88 8 0 5% 21-513
tests/unit/test_state_manager.py 31 24 0 0 23% 26-41, 46-61, 68-77
tests/unit/test_util.py 37 26 2 0 28% 21-23, 28-36, 41-49, 54-62, 141-145, 159-160
tests/unit/test_validation_builder.py 68 63 0 0 7% 24-349
----------------------------------------------------------------------------------------------------
TOTAL 4663 4323 916 0 6%
FAIL Required test coverage of 70.0% not reached. Total coverage: 6.09%
========================================================================================= short test summary info ==========================================================================================
ERROR tests/unit/ibis_addon/test_operations.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test__main.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test_cli_tools.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test_clients.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test_combiner.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test_config_manager.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test_data_validation.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test_partition_builder.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test_schema_validation.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
ERROR tests/unit/test_validation_builder.py - TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 10 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1 warning, 10 errors in 4.31s
Finish TEST COVERAGE
Start CODE STYLE (FLAKE8)
tests/unit/test_cli_tools.py:990:45: W292 no newline at end of file
Finish CODE STYLE (FLAKE8)
Start CODE FORMATTING (BLACK)
reformatted tests/unit/test_cli_tools.py
All done! ✨ 🍰 ✨
1 file reformatted, 132 files left unchanged.
Finish CODE FORMATTING (BLACK) |
/gcbrun |
Hi @sundar-mudupalli-work, the latest build failed after 11m, could you please check what happened and take a look at the recent changes and comment added by @safe049? Thanks! |
Hi, Sorry for the delay. Thank you for pursuing this and let me know what I can do to take this effort to completion. There is a lint failure with the current tests as follows:
Please run flake8 and black before submitting any code. I am not sure how much Helen has briefed you on the different steps we have before merging the changes into develop. I tried editing this file - however the only option it would give me was to update develop - since the branch it is coming from (your repo) is a place where I may not have permission to update. Sundar Mudupalli |
I will do black BTW,I have invited you into my branch so that you can access my fork |
/gcbrun |
Hi @safe049 , a quick question on the new test The test has 5 Thanks |
Added more unit test for CLI options
Added unit test for Oracle, PostgreSQL, SQLserver, DB2's connection