Skip to content

Ability to retrieve defaults from a file #30

@MatanIdan96

Description

@MatanIdan96

Hi!

I am using pytest class in a session that uses for each test parametrize_from_file with toml file.

I need to explicite now the defaults of the test as follow:

class TestCreatePricingVersionAggregativeConstraint:
    DEFAULT_SCHEMA_DICT = \
        {"project_path": "blablabla",
         "pricing": True,
          ...
         "npv_horizon": 1,
         }


    @pff.parametrize(schema=[pff.cast(), pff.defaults(**DEFAULT_SCHEMA_DICT)])
    def test_create_version_single_multivariate_optimization_with_custom_aggregative_constraint(
        project_path, ...
        pff_selective_copy_and_open_project_using_projects_cache):

        source_project_id, copied_project_id, copied_project_path = pff_selective_copy_and_open_project_using_projects_cache
  
        pass


    @allure.link("https://earnix.atlassian.net/browse/ESA-372", "Jira: ESA-372")
    @allure.testcase("https://earnix.atlassian.net/plugins/servlet/ac/com.infostretch.QmetryTestManager/qtm4j-test-management?project.key=QEP&project.id=11234#!/TestCaseDetail/R53FZDAtbaVY3/1?projectId=11234", "QEP-tc-715")
    @pff.parametrize(schema=[pff.cast(), pff.defaults(**DEFAULT_SCHEMA_DICT)])
    def test_create_version_single_multivariate_optimization_with_custom_aggregative_constraint_from_non_root_level(
        project_path, ...
            pricing, 
        pff_selective_copy_and_open_project_using_projects_cache):

        source_project_id, copied_project_id, copied_project_path = pff_selective_copy_and_open_project_using_projects_cache

        # Expect an SdkError to be raised"
        pass

I cenzored most of the parts of the code due to security data.
I just need to understand if there is a way to insert the default parameters to the toml itself? on the same toml of course.

my toml looks like this:

[[test_create_version_single_multivariate_optimization_with_custom_aggregative_constraint_from_non_root_level]]
version = "\blablam"
sector_discriminator = "Drblablablae"
comment = ""
error_message = "Thblabla."

[[test_create_version_single_multivariate_optimization_with_custom_aggregative_constraint]]
version = "\blablaba"
aggr_constraints = [...]
warm_start=false

also - having an hirarchy in the parameters- parameters that all the class uses. and paramters just for the test from the toml file defined. to decorate maybe all the class in paramtrize_from_file? is there any support for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions