tum-ei-eda / mlonmcu

Tool for the deployment and analysis of TinyML applications on TFLM and MicroTVM backends
Apache License 2.0
28 stars 12 forks source link

Better lock #81

Closed PhilippvK closed 1 year ago

PhilippvK commented 1 year ago

74

zhouxinyu0723 commented 1 year ago

this test case cannot pass. Should I init MlonMcuContext with read lock for this test case?

def test_nest_context(monkeypatch, fake_environment_directory: Path, fake_config_home: Path):
    monkeypatch.chdir(fake_environment_directory)
    create_minimal_environment_yaml(fake_environment_directory / "environment.yml")
    with mlonmcu.context.context.MlonMcuContext() as context:
        assert context
        with mlonmcu.context.context.MlonMcuContext() as context2:
            assert context2
PhilippvK commented 1 year ago

@zhouxinyu0723 I think we should refactor this one to check several cases (valid and invalid ones):

The default case which is now write + write should fail.

For success you can just week using assertions, for fail you can use pytest.raises or something similar.

PhilippvK commented 1 year ago

@zhouxinyu0723 Can you give me an update on the status? If this is ready for review, remove the "Draft: " prefix from the PR title.

In addition, to keep the commit history clean, I would recommend doing a rebase on origin/main + squashing of similar commits. I can show you how to achieve this, if you need help.

PhilippvK commented 1 year ago

Looks good to merge. Thank you! I will update the README later.