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

tests speedup #119

Merged
merged 23 commits into from
Jun 5, 2023
Merged

tests speedup #119

merged 23 commits into from
Jun 5, 2023

Conversation

naik-aakash
Copy link
Collaborator

@naik-aakash naik-aakash commented Jun 5, 2023

  • Test adding adding splits tag to pytest for speedup

@naik-aakash
Copy link
Collaborator Author

naik-aakash commented Jun 5, 2023

Hi @JaGeo , This PR tries to resolve the open #97 issue.

At the moment it seems to work with significant reduction in time needed for executing tests. Have attempted to use similar strategy as of pymatgen. There seems to be one small issue, there seems to be some loss of coverage, and it mainly seems to stem from tests that used pytest-plugins. If you have any idea how to solve this let me know. I am looking into this as well. So far no luck 😞

@JaGeo
Copy link
Owner

JaGeo commented Jun 5, 2023

@naik-aakash Thanks for trying! No idea why the coverage reduces so drastically ...

@@ -27,7 +28,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-mock
python -m pip install flake8 pytest pytest-mock pytest-split pytest-cov
python -m pip install types-setuptools
python -m pip install coverage
Copy link
Owner

Choose a reason for hiding this comment

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

Do you need the second coverage when you install pytest-cov?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we do not need the second coverage. Was trying different possible solutions I could find, one option stated trying to use pytest-cov. But End result was still the same so, we can get rid of it seems.

@@ -40,5 +41,30 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and coverage
run: |
coverage run -m pytest
coverage report
pytest --cov=lobsterpy --cov-append --splits 10 --group ${{ matrix.split }} --durations-path ./lobsterpy/.pytest-split-durations
Copy link
Owner

Choose a reason for hiding this comment

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

To me it looks like you are doing 10 splits but only run 5 out of the 10? Do I overlook something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh I see, I made some blunder. Let me fix it. I make 5 splits at top and forgot to change to 5 here. Probably that is root cause of this reduced coverage

@JaGeo
Copy link
Owner

JaGeo commented Jun 5, 2023

I changed it already. Let's test the workflow with the 10 splits.

@JaGeo
Copy link
Owner

JaGeo commented Jun 5, 2023

I will get back to this tomorrow.

@naik-aakash
Copy link
Collaborator Author

I will get back to this tomorrow.

Number of splits was the error. It works perfectly now.

@naik-aakash naik-aakash changed the title WIP [tests speedup] tests speedup Jun 5, 2023
@JaGeo JaGeo merged commit bae7e40 into JaGeo:main Jun 5, 2023
@JaGeo
Copy link
Owner

JaGeo commented Jun 5, 2023

I am merging it. Thanks @naik-aakash.

@naik-aakash naik-aakash deleted the tests-speedup branch October 28, 2023 14:45
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