mik-laj commented on a change in pull request #13502:
URL: https://github.com/apache/airflow/pull/13502#discussion_r552503227



##########
File path: docs/apache-airflow/best-practices.rst
##########
@@ -228,11 +228,36 @@ Do not hard code values inside the DAG and then change 
them manually according t
 
 You can use environment variables to parameterize the DAG.
 
-.. code-block::
+.. code-block:: python
+
+   import os
+
+   dest = os.environ.get(
+      "MY_DAG_DEST_PATH",
+      "s3://default-target/path/"
+   )
+
+Mocking variables and connections
+=================================
+
+You can set an environment variable to configure variables or connections to 
limit interaction with the database.

Review comment:
       ```suggestion
   When you write tests for code that uses variables or a connection, you must 
ensure that they exist when you run the tests. The obvious solution is to save 
these objects to the database so they can be read while your code is executing. 
However, reading and writing objects to the database are burdened with 
additional time overhead. In order to speed up the test execution, it is worth 
simulating the existence of these objects without saving them to the database. 
For this, you can create environment variables with mocking :any:`os.environ` 
using :meth:`unittest.mock.patch.dict`.
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to