Skip to content

Commit 80d039e

Browse files
quality check fixes
1 parent 10ace0f commit 80d039e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ This blueprint provides the following utility classes, that can be used to aid i
8484
## Using Environment Variables For Secrets
8585

8686
This blueprint provides functionality for saving secret / sensitive values that you would not want present
87-
in the codebase, but require to execute tests locally (such as passwords or API keys). A local.env file can
87+
in the codebase, but require to execute tests locally (such as passwords or API keys). A local.env file can
8888
be generated by running the [following script](./setup_env_file.py):
8989

9090
```shell
@@ -99,11 +99,13 @@ script can be run to onboard new team members and provide a local file with all
9999
The local.env file (if present), is read at the start of any test session (via the [conftest.py file](./conftest.py))
100100
and any variables can be accessed by using the Python os library like so:
101101

102-
# Import the OS library
103-
import os
102+
```python
103+
# Import the OS library
104+
import os
104105

105-
# Access environment variable
106-
os.getenv('<key_from_local.env>')
106+
# Access environment variable
107+
os.getenv('<key_from_local.env>')
108+
```
107109

108110
The local.env file is set in the [.gitignore file](./.gitignore), so by default it will not commit if amended.
109111

setup_env_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
This script creates a local.env file that can be used to populate secrets such as passwords or API keys
3-
locally. This is useful for local development and testing, as it allows you to keep sensitive information
3+
locally. This is useful for local development and testing, as it allows you to keep sensitive information
44
out of your codebase.
55
66
This is designed to be generated when setting up this project, so if new variables are required, these

tests/test_example.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"""
99

1010
import pytest
11+
import logging
12+
import os
1113
from playwright.sync_api import Page, expect
1214

1315

@@ -41,7 +43,7 @@ def test_basic_example(page: Page) -> None:
4143
2) Asserts that the README contents rendered by GitHub contains the text "Playwright Python Blueprint"
4244
3) Asserts that the main section of the page contains the topic label "playwright-python"
4345
'''
44-
46+
logging.info(f"Test variable: {os.getenv('USER_PASS')}")
4547
# Assert repo text is present
4648
expect(page.get_by_role("article")).to_contain_text("Playwright Python Blueprint")
4749

0 commit comments

Comments
 (0)