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

Prevent bad practice in python tests #482

Merged
merged 2 commits into from
Jul 31, 2020

Conversation

revans2
Copy link
Collaborator

@revans2 revans2 commented Jul 31, 2020

In general trying to access the spark session outside of a with_*_session can result in tests that don't do what you want them to do. To help prevent this from happening this makes spark which was available for everyone to use before now _spark which shows that it is intended to be private. It also adds a check when returning something from a with_*_session to try and avoid someone returning a dataframe. When you create a dataframe with one config and then change configs spark has some lazy processing and you don't always get what you expect in terms of how that data was configured.

Signed-off-by: Robert (Bobby) Evans <[email protected]>
@revans2 revans2 self-assigned this Jul 31, 2020
@revans2
Copy link
Collaborator Author

revans2 commented Jul 31, 2020

build

kuhushukla
kuhushukla previously approved these changes Jul 31, 2020

def get_spark_i_know_what_i_am_doing():
"""
Get the current SparkSession. Because of how tests work
Copy link
Collaborator

Choose a reason for hiding this comment

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

it might be nice to state why

@sameerz sameerz added the test Only impacts tests label Jul 31, 2020
@revans2
Copy link
Collaborator Author

revans2 commented Jul 31, 2020

build

@revans2
Copy link
Collaborator Author

revans2 commented Jul 31, 2020

@kuhushukla and @tgravescs could you take another look?

@revans2 revans2 merged commit 05a720c into NVIDIA:branch-0.2 Jul 31, 2020
nartal1 pushed a commit to nartal1/spark-rapids that referenced this pull request Jun 9, 2021
* Prevent bad practice in python tests

Signed-off-by: Robert (Bobby) Evans <[email protected]>

* Addressed review comments
nartal1 pushed a commit to nartal1/spark-rapids that referenced this pull request Jun 9, 2021
* Prevent bad practice in python tests

Signed-off-by: Robert (Bobby) Evans <[email protected]>

* Addressed review comments
pxLi pushed a commit to pxLi/spark-rapids that referenced this pull request May 12, 2022
tgravescs pushed a commit to tgravescs/spark-rapids that referenced this pull request Nov 30, 2023
Signed-off-by: spark-rapids automation <[email protected]>

Signed-off-by: spark-rapids automation <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Only impacts tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants