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

Improve tests coverage for BigQuery and Sharepoint source classes #716

Merged
merged 8 commits into from
Jul 26, 2023

Conversation

Rafalz13
Copy link
Contributor

@Rafalz13 Rafalz13 commented Jul 7, 2023

Summary

The task is to improve the coverage of source classes. For a lot of source classes the coverage is on low level.

Importance

To have as high coverage as possible.

Checklist

This PR:

  • follows the guidelines laid out in CONTRIBUTING.md
  • links relevant issue(s)
  • adds/updates tests (if appropriate)
  • adds/updates docstrings (if appropriate)
  • adds an entry in CHANGELOG.md

Copy link
Contributor

@adrian-wojcik adrian-wojcik left a comment

Choose a reason for hiding this comment

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

It could be good to add docstrings to test function, so in future it could be easier and faster to understand what these functions are testing.

tests/integration/test_bigquery.py Show resolved Hide resolved
tests/integration/test_bigquery.py Outdated Show resolved Hide resolved
tests/integration/test_bigquery.py Show resolved Hide resolved
tests/integration/test_bigquery.py Show resolved Hide resolved
tests/integration/test_bigquery.py Show resolved Hide resolved
total_received = df["total"].values

assert total_received == [4924235, 4818746, 4703680, 4280040]


def test_wrong_query(BIGQ):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add docstring with raises section

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are checking here if the exception is raised and not raising a new exception.

@@ -29,7 +29,13 @@ def FILE_NAME(sharepoint):
os.remove(path)


def test_credentials():
def test_credentials_not_found():
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add docstring with raises section

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are checking here if the exception is raised and not raising a new exception.

LIMIT 4
"""
with pytest.raises(DBDataAccessError):
_ = BIGQ.query_to_df(fake_query)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if there is need of assigning function to variable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

Sharepoint(credentials=none_credentials)


def test_get_connection_credentials():
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add docstring with raises section

@@ -57,6 +63,11 @@ def test_sharepoint_to_df_task():
os.remove("Questionnaires.xlsx")


def test_download_file(sharepoint):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add docstring with raises section

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are checking here if the exception is raised and not raising a new exception.

@Rafalz13 Rafalz13 requested a review from m-paz July 24, 2023 14:32
@Rafalz13 Rafalz13 changed the title Improve tests coverage for source classes Improve tests coverage for Bigquery and Sharepoint source classes Jul 26, 2023
@Rafalz13 Rafalz13 changed the title Improve tests coverage for Bigquery and Sharepoint source classes Improve tests coverage for BigQuery and Sharepoint source classes Jul 26, 2023
Copy link
Contributor

@angelika233 angelika233 left a comment

Choose a reason for hiding this comment

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

looks good, only one small suggestion

tests/integration/test_sharepoint.py Outdated Show resolved Hide resolved
@Rafalz13 Rafalz13 merged commit 40d406e into dev Jul 26, 2023
3 checks passed
@trymzet trymzet deleted the improve_source_tests_v1 branch June 5, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants