fix(client-lib): commented code block for test setup #5711

- Add CONTRIBUTING.md step for building the influxdata:docs-pytest image before running tests.
pr/MeelahMe/5723
Jason Stirnaman 2024-12-30 11:44:21 -06:00
parent 103ba61436
commit 326c9827c3
2 changed files with 19 additions and 4 deletions

View File

@ -57,6 +57,17 @@ Install [Docker](https://docs.docker.com/get-docker/) for your system.
docs-v2 includes Docker configurations (`compose.yaml` and Dockerfiles) for running the Vale style linter and tests for code blocks (Shell, Bash, and Python) in Markdown files. docs-v2 includes Docker configurations (`compose.yaml` and Dockerfiles) for running the Vale style linter and tests for code blocks (Shell, Bash, and Python) in Markdown files.
#### Build the test dependency image
After you have installed Docker, run the following command to build the test
dependency image, `influxdata:docs-pytest`.
The tests defined in `compose.yaml` use the dependencies and execution
environment from this image.
```bash
docker build -t influxdata:docs-pytest -f Dockerfile.pytest .
```
### Run the documentation locally (optional) ### Run the documentation locally (optional)
To run the documentation locally, follow the instructions provided in the README. To run the documentation locally, follow the instructions provided in the README.

View File

@ -17,9 +17,9 @@ related:
list_code_example: > list_code_example: >
```python ```python
Example: Writing and querying data # Example: Write and que data
# The following example demonstrates how to write sensor data into influxDB # Write sensor data into influxDB
# and retrieve data from the last 90 days for analysis. # and retrieve data from the last 90 days for analysis.
@ -171,10 +171,13 @@ Given that `write_client_options` isn't specified, the client uses the default [
{{% code-placeholders "DATABASE_(NAME|TOKEN)" %}} {{% code-placeholders "DATABASE_(NAME|TOKEN)" %}}
<!-- Import for tests and hide from users. --> <!-- Import for tests and hide from users.
<!-- ```python
import os import os
```
--> -->
<!--pytest-codeblocks:cont-->
```python ```python
from influxdb_client_3 import InfluxDBClient3 from influxdb_client_3 import InfluxDBClient3
@ -182,6 +185,7 @@ client = InfluxDBClient3(host=f"{{< influxdb/host >}}",
database=f"DATABASE_NAME", database=f"DATABASE_NAME",
token=f"DATABASE_TOKEN") token=f"DATABASE_TOKEN")
``` ```
{{% /code-placeholders %}} {{% /code-placeholders %}}
Replace the following: Replace the following: