Skip to content

Add unit tests, see #24#26

Merged
rbarillot merged 6 commits into
masterfrom
tests
Nov 10, 2025
Merged

Add unit tests, see #24#26
rbarillot merged 6 commits into
masterfrom
tests

Conversation

@rbarillot

Copy link
Copy Markdown
Collaborator

Add unit tests in test/test_wheatfspm.py

@rbarillot rbarillot requested review from baugetfa and pradal November 6, 2025 18:59

@baugetfa baugetfa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run fast on my machine.
Do not forget to change in conda.yaml in the test part the command to something like:

  commands:
    - cd test
    - pytest -v
    
``̀`

@rbarillot

Copy link
Copy Markdown
Collaborator Author

TY @baugetfa .
I modified the meta.yaml file according to your suggestion. Should I also modify the pyproject.toml in the test section, which is not consistant with the meta.yaml at present.
I have also noticed that the dependancies sections of the environment.yaml and pyproject.toml are not consistant either.

@baugetfa

baugetfa commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Yes. So because the CI is ok that means that the dependencies in meta.yaml are the good one so you can report them to the pyproject.toml. After that if you want you can change the requires: in meta.yaml as flollows:

test:
  requires:
    {% for dep in test_deps %}
    - {{ dep }}
    {% endfor %}

Then indeed the environment.yaml and pyproject.toml should be consistent so you just have to add openalea.widgets to environment.yaml. In the environment.yaml we list python, pip and conda dependencies after this is pip that will manage other dependencies.

@rbarillot

Copy link
Copy Markdown
Collaborator Author

It's a bit confusing for me, but I've made a new commit. Is it better that way? I'm not sure about the [project.optional-dependencies] test = section in the pyproject.toml

@rbarillot

Copy link
Copy Markdown
Collaborator Author

oups...it seems I broke the CI :/

@baugetfa

baugetfa commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

That is normal because I forgot to tell you to add the following line at the beginning of the meta.yaml:

{% set test_deps = pyproject.get('project', {}).get('optional-dependencies', {}).get('test',[]) %}

This line defines test_deps. So just add this line just after the line starting by {% set conda_deps.

@rbarillot

Copy link
Copy Markdown
Collaborator Author

Great, CI was successful !
Can you confirm that the meta.yaml, pyproject.toml and environment.yml are consistent please?

@baugetfa

Copy link
Copy Markdown
Contributor

Yes I confirm everything is consistent. I think you can merge if you finished with this PR.

@baugetfa

Copy link
Copy Markdown
Contributor

Wait just

@baugetfa

Copy link
Copy Markdown
Contributor

May be add to meta.yaml imports openalea.wheatfspm as follows:

test:
  requires:
    {% for dep in test_deps %}
    - {{ dep }}
    {% endfor %}

  imports:
    - openalea.wheatfspm

It is not mandatory, the proof is that the CI worked, but it is recommended.

@rbarillot

Copy link
Copy Markdown
Collaborator Author

the import statement seems to trigger an error.

@baugetfa

Copy link
Copy Markdown
Contributor

Oups sorry I wrote openalea.wheatfspm but according to the test it is openalea.fspmwheat . This is a bit inconsistent with the project name. But what ever. So change to openalea.fspmwheat or just removed this import addition. Sorry again.

@rbarillot

Copy link
Copy Markdown
Collaborator Author

no problem! I just don't understand where it is specified openalea.fspmwheat rather than openalea.wheatfspm?

@baugetfa

Copy link
Copy Markdown
Contributor

In your test_wheatfspm.py in your imports this is from openalea.fspmwheat import that is used. In src/openalea there is no wheatfspm only fspmwheat so openalea.wheatfspmdoes not exist.
So in the meta.yaml it should be openalea.fspmwheat. As I said that is not mandatory, the CI passed without it, it is only recommended to ensure that the module import works.

@rbarillot rbarillot merged commit 1bf954c into master Nov 10, 2025
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants