Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MDobransky committed Sep 5, 2024
1 parent f22301a commit f7e0265
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,11 @@ Assuming we have a my_package.test_job_module.py module:
```python3
@datasource
def datasource_a(...)
... code ...
... code...

@job
def my_job(datasource_a, ...)
... code ...
... code...
```
The *disable_job_decorators* context manager, as the name suggests, disables all decorator functionality and lets you access your functions as raw functions - making it super simple to unit-test:

Expand All @@ -459,31 +459,23 @@ import my_package.test_job_module as tjm

# Datasource Testing
def test_datasource_a():
...
mocks
here...
... mocks here...

with disable_job_decorators(tjm):
datasource_a_output = tjm.datasource_a(...
mocks...)
datasource_a_output = tjm.datasource_a(...mocks...)

...
asserts...
...asserts...


# Job Testing
def test_my_job():
datasource_a_mock = ...
...
other
mocks...
...other mocks...

with disable_job_decorators(tjm):
job_output = tjm.my_job(datasource_a_mock, ...
mocks...)
job_output = tjm.my_job(datasource_a_mock, ...mocks...)

...
asserts...
...asserts...
```

#### 2. Testing the @job Dependency Tree
Expand Down

0 comments on commit f7e0265

Please sign in to comment.