Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to have the same python filenames in different integration test directories #994

Open
maaikez opened this issue Dec 16, 2024 · 0 comments

Comments

@maaikez
Copy link
Contributor

maaikez commented Dec 16, 2024

Describe the problem

For the python integration tests of cost and price and display message, there was a new file created to test those for ocpp 1.6. It turns out that when two files have the same name, although they are in a different directory, that the test fails. To fix it, you can for example add an init.py in all directories containing test cases. But when doing that, this error is shown for almost all tests:

>       environment_setup.setup_environment(tmp_path=tmp_path)

/usr/local/lib/python3.11/dist-packages/everest/testing/core_utils/fixtures.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.11/dist-packages/everest/testing/core_utils/_configuration/everest_environment_setup.py:124: in setup_environment
    self._everest_core = EverestCore(self._core_config.everest_core_path,
/usr/local/lib/python3.11/dist-packages/everest/testing/core_utils/everest_core.py:122: in __init__
    self._write_temporary_config(config_path, everest_configuration_adjustment_strategies)
/usr/local/lib/python3.11/dist-packages/everest/testing/core_utils/everest_core.py:148: in _write_temporary_config
    everest_config = strategy.adjust_everest_configuration(everest_config)
/usr/local/lib/python3.11/dist-packages/everest/testing/core_utils/_configuration/everest_configuration_strategies/ocpp_module_configuration_strategy.py:48: in adjust_everest_configuration
    self._verify_module_config(adjusted_config)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <everest.testing.core_utils._configuration.everest_configuration_strategies.ocpp_module_configuration_strategy.OCPPModuleConfigurationStrategy object at 0x7f80a0c38810>
everest_config = {'active_modules': {'auth': {'config_module': {'connection_timeout': 20}, 'connections': {'evse_manager': [{'implement...n_id': 'energy_grid', 'module_id': 'grid_connection_point'}]}, 'module': 'EnergyManager'}, ...}, 'x-module-layout': {}}

    def _verify_module_config(self, everest_config):
        """ Verify the provided config fits the provided OCPP version """
        assert "active_modules" in everest_config and self._ocpp_module_id in everest_config[
            "active_modules"], "OCPP Module is missing from EVerest config"
        ocpp_module = everest_config["active_modules"][self._ocpp_module_id]["module"]
        assert (ocpp_module == "OCPP" and self._ocpp_version == OCPPVersion.ocpp16) or (
>               ocpp_module == "OCPP201" and self._ocpp_version == OCPPVersion.ocpp201), \
            f"Invalid OCCP Module {ocpp_module} for provided OCCP version {self._ocpp_version}"
E       AssertionError: Invalid OCCP Module OCPP for provided OCCP version OCPPVersion.ocpp201

/usr/local/lib/python3.11/dist-packages/everest/testing/core_utils/_configuration/everest_configuration_strategies/ocpp_module_configuration_strategy.py:63: AssertionError

And the test fails.

See also pytest-dev/pytest#3151 and https://docs.pytest.org/en/stable/explanation/goodpractices.html#tests-outside-application-code

After changes have been made to fix this, make sure to change the name of the test file california_pricing_ocpp16.py back to california_pricing.py.

EVerest Domain

OCPP, OCPP1.6, OCPP2.0.1

Affected EVerest Module

libocpp

Describe your solution

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant