[test] Add shared pytest fixtures via conftest.py#172
Open
adity1raut wants to merge 2 commits into52North:mainfrom
Open
[test] Add shared pytest fixtures via conftest.py#172adity1raut wants to merge 2 commits into52North:mainfrom
adity1raut wants to merge 2 commits into52North:mainfrom
Conversation
Signed-off-by: Saloni Tarone <taronesaloni@gmail.com>
Signed-off-by: Aditya Raut <araut7798@gmail.com>
Collaborator
|
Hi @adity1raut, thank you for your PR. We appreciate the time and effort that was put into it. Please be aware that we require to follow 52 North's CLA guidelines for all PRs and, in particular, fill the 52°North Contributor License Agreement. As long as this has not been filled, I can not assign you to any issues or merge any PRs. Please don't hesitate to contact me in case of related questions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue / Discussion:
Please delete the option which is not relevant.
Fixes Issue #XX
Relates to discussion [Improve Test Framework – GSoC 2025 Code Challenge]
Changes:
tests/conftest.py– shared pytest fixtures for the WRT test suiteFurther Details:
Summary:
Before: Every test file independently called
basic_test_func.create_dummy_Direct_Power_Ship(),basic_test_func.create_dummy_IsoFuel_object(), and repeated path-buildingboilerplate (
os.path.dirname(__file__)+ joins) to set up the same objects.This made tests harder to read and changes to test setup require edits in
multiple files.
After: A single
tests/conftest.pyprovides session- and function-scopedfixtures that any test can request by name. Session-scoped fixtures
(
simpleship,manualship,isofuel_algorithm,isobased_algorithm,wrt_config,ship_config) are constructed once per test run, reducing I/Ooverhead. Function-scoped fixtures (
base_ship_config_dict,simpleship_from_dict) are recreated per test to prevent state leakage.Fixtures added:
test_data_dirtests/data/tests_config_pathconfig.tests.jsonwrt_configConfigloaded fromconfig.tests.jsonship_configShipConfigloaded fromconfig.tests.jsonsimpleshipDirectPowerBoatwith auto-calculated geometrymanualshipDirectPowerBoatwith manual geometrybase_ship_config_dictdictsimpleship_from_dictDirectPowerBoatbuilt from dictisofuel_algorithmIsoFuelrouting algorithm objectisobased_algorithmIsoBasedrouting algorithm objectDependencies:
No new dependencies.
conftest.pyuses only packages already listed inrequirements.test.txt(pytest) and the existingtests/basic_test_func.pyhelper module.
Changes:
Please list the central functionalities that have been changed:
Further Details:
Summary:
Please mention the relevant motivation and context of your changes and shortly describe the behaviour before and after your modifications.
Dependencies:
Please list new dependencies that are required for this modification.
PR Checklist:
In the context of this PR, I:
Please consider that PRs which do not meet the requirements specified in the checklist will not be evaluated. Also, PRs with no activities will be closed after a reasonable amount of time.