Python file testing using pytest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 09:11 AM
Hi All,
I have a requirement in my project, where we will be writing some python code inside databricks . Please note we will not be using pyspark . It will plain pythin with polars.
I am looking into ho to create test files for main file. Below is simple example which i am trying
Inside repo - i created a file called function_file.py. I wrote a simple function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 11:25 PM
Thanks Kaniz or your answer. However I think i am struggling to understand some basics.
Currently i just wrote a simple test function.
def test_something():
assert 1==1
This test passes , but when i make any small change in this function ,it doesnt reflect .
Example i change assert to 1==0, but my output is still same.
How to refresh main notebook which i am using to run tests files to pick latest change from tests files please? One solution is to restart cluster every time , but that's very bad solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 08:24 AM
Hi @sudhanshu1,
Try running dbutils.library.restartPython() in your notebook after you make any changes to the function_file.py file.