Skip to content

Commit ee096e3

Browse files
Adding pythonpath variable (#37)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> This adds the pythonpath option to pytest.ini with the location set to the base of the project. ## Context <!-- Why is this change required? What problem does it solve? --> Depending on the users configuration, sometimes pytest isn't able to see modules it needs to see. This just sets the pythonpath to the default to hopefully help those users. This has been added thanks to the information provided by @andrew-cleveland. ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [ ] Refactoring (non-breaking change) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I am familiar with the [contributing guidelines](https://github.com/nhs-england-tools/playwright-python-blueprint/blob/main/CONTRIBUTING.md) - [x] I have followed the code style of the project - [ ] I have added tests to cover my changes (where appropriate) - [x] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.
1 parent 7e0a8fc commit ee096e3

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"organisation",
1515
"pytest",
1616
"pytestmark",
17+
"pythonpath",
18+
"recognise",
1719
"retcode",
1820
"ruleset",
1921
"utilise",

docs/getting-started/2_Blueprint_File_Breakdown.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ This file outlines the configuration of pytest, and ultimately how Playwright al
3333
- Generate a HTML report in a single file, and output it in the `test-results` directory with the name `report.html`
3434
- Generate a JSON report, omitting some collection data and then output it in the `test-results` directory with the name `results.json`
3535
- Only generate Playwright stack-trace files when a test fails
36+
- The `pythonpath` section just sets the base of this project for the pythonpath system variable utilised by pytest. This is designed to mitigate local configuration issues, see the [pytest documentation for more information](https://docs.pytest.org/en/stable/explanation/pythonpath.html).
3637
- The `markers` section is for organizing any marks (or tags) you want to apply to your tests, for example by a business area or a testing type. If you don't include your marks in this list, pytest will give you a warning until they have either been added here or programmatically within the code.
3738

3839
Any configuration you want to apply to all of your test executions should be placed in this file where possible, to ensure easy maintenance.

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ addopts =
1313
--json-report-omit=collectors
1414
--tracing=retain-on-failure
1515

16+
# Allows pytest to identify the base of this project as the pythonpath
17+
pythonpath = .
18+
1619
# These are the tags that pytest will recognise when using @pytest.mark
1720
markers =
1821
example: tests used for example purposes by this blueprint

0 commit comments

Comments
 (0)