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

change from unittest to pytest #348

Merged
merged 100 commits into from
Apr 15, 2024
Merged

change from unittest to pytest #348

merged 100 commits into from
Apr 15, 2024

Conversation

OberGue
Copy link
Member

@OberGue OberGue commented Feb 2, 2024

Overview

Changing unittest to pytest
This is a new PR instead of this one with less changes in the beginning.

Addressed issues

Showcase

...

Checklists

  • Documentations are up-to-date.
  • Added example(s)
  • Added test(s)

@j042
Copy link
Member

j042 commented Feb 2, 2024

file name should be conftest.py

@j042 j042 marked this pull request as draft February 2, 2024 20:36
@OberGue OberGue closed this Feb 2, 2024
@OberGue OberGue reopened this Feb 2, 2024
@j042
Copy link
Member

j042 commented Feb 2, 2024

and the point of it is not to import manually for all test cases

@clemens-fricke
Copy link
Contributor

Please make sure to use the pre-commit hook before you commit/push. (https://pre-commit.com/)

Also, it would be nice if you could add a remark to the pyproject.toml file so that you can run pytest from the root directory.
Something like this.

[tool.pytest.ini_options]
addopts = "-ra -q"
testpaths = [
    "test_pytest",
]

Copy link
Contributor

@clemens-fricke clemens-fricke left a comment

Choose a reason for hiding this comment

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

Just a few comments on the last commit.

Thank you for your work.

test_pytest/test_cartesian.py Outdated Show resolved Hide resolved
test_pytest/conftest.py Outdated Show resolved Hide resolved
test_pytest/conftest.py Outdated Show resolved Hide resolved
Copy link
Member

@j042 j042 left a comment

Choose a reason for hiding this comment

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

Great progress!

test_pytest/test_multipatch.py Outdated Show resolved Hide resolved
test_pytest/test_bezier_extraction.py Outdated Show resolved Hide resolved
test_pytest/test_c_contiguous.py Outdated Show resolved Hide resolved
test_pytest/test_evaluation.py Outdated Show resolved Hide resolved
test_pytest/test_evaluation.py Outdated Show resolved Hide resolved
test_pytest/test_multipatch.py Outdated Show resolved Hide resolved
test_pytest/test_npz.py Outdated Show resolved Hide resolved
@@ -0,0 +1,82 @@
"""Test Orientation between adjacent spline patches
Copy link
Member

Choose a reason for hiding this comment

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

this file changes with #391. just a note

test_pytest/test_spline_constructors.py Outdated Show resolved Hide resolved
test_pytest/test_spline_type_conversion.py Outdated Show resolved Hide resolved
test_pytest/test_gismo.py Outdated Show resolved Hide resolved
test_pytest/test_creator.py Outdated Show resolved Hide resolved
test_pytest/test_creator.py Outdated Show resolved Hide resolved
test_pytest/test_creator.py Outdated Show resolved Hide resolved
pyproject.toml Outdated
@@ -105,6 +105,7 @@ lint.ignore = [
"setup.py" = ["T201"]
"examples/*.py" = ["T201"]
"tests/common.py" = ["T201"]
"test_pytest/conftest.py" = ["T201"]
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not necessary after test folder rename

test_pytest/io/test_json.py Outdated Show resolved Hide resolved
test_pytest/io/test_irit.py Outdated Show resolved Hide resolved
test_pytest/test_evaluation.py Outdated Show resolved Hide resolved
test_pytest/test_greville.py Outdated Show resolved Hide resolved
test_pytest/test_property_modification.py Outdated Show resolved Hide resolved
test_pytest/test_property_modification.py Outdated Show resolved Hide resolved
test_pytest/io/test_gismo.py Outdated Show resolved Hide resolved
test_pytest/io/test_gismo.py Outdated Show resolved Hide resolved
@j042 j042 requested a review from clemens-fricke April 11, 2024 13:09
@j042 j042 added cibuildwheel-test Ask ci to test all wheel builds ci/cd Workflows for continuous integration and continuous delivery testing All about software testing labels Apr 11, 2024
@j042 j042 requested review from danielwolff1 and jzwar April 11, 2024 13:17
@j042 j042 added cibuildwheel-test Ask ci to test all wheel builds and removed cibuildwheel-test Ask ci to test all wheel builds labels Apr 11, 2024
Copy link
Member

@j042 j042 left a comment

Choose a reason for hiding this comment

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

Great, thanks a lot @OberGue @clemens-fricke !

tests/io/test_cats.py Outdated Show resolved Hide resolved
@j042 j042 merged commit b9d32be into main Apr 15, 2024
20 checks passed
@j042 j042 deleted the ft-pytests branch April 15, 2024 03:01
markriegler pushed a commit that referenced this pull request Aug 6, 2024
* Added directories and conf_pytest.py-file

* Added test_arrays.py-file and changed it to pytest

* Added test_bezier_extraction.py-file and changed it to pytest

* Changed filename to conftest.py

* Defined fixtures in conftest and adjusted testfiles to pytest

* Added bezier_operations-File; simplified bezier_extractions-File and conftest-File

* Fix: Generator initialization, Add: warning supression for jupyter_client, Add: config to run just test_pytest folder

* Fix: using np_rng-fixture consistently now

* Add: test_c_contiguous-file and changed it to pytest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add: test_cartesian-file and changed it to pytest

* Add: test_cats-file and changed it to pytest; Fix: conftest according to test_cats; Fix: test_cartesian to np_rng-fixture

* Add: test_creator-file and changed it to pytest, note: WIP

* Fix: finished test_creator-file

* Fix: every np_rng-fixture-call now without request

* Add: test_evaluation-file and changed it to pytest; Note: error and WIP

* Fix: test_evaluation-file error solved; test_creator-file comment removed

* Fix: test_evaluation-file - added new testfunction and setup function

* Add: testfunctions in test_evaluation-file

* Fix: test_evaluation-file - getting rid of getfixturevalue where unnecessary

* Ft: example for parameterization

* Add: test_extract-file and changed it to pytest

* Add: test_fitting-file and changed it to pytest

* Add: test_gismo-file and changed it to pytest; Note: error - super() has no attribute interfaces

* Add: test_greville-file and changed it to pytest

* Add: test_iges-file and changed it to pytest

* Add: test_irit_io-file and changed it to pytest

* Add: test_json-file and changed it to pytest

* Add: test_knot_vectors-file and changed it to pytest

* Add: test_kv_manipulation-file and changed it to pytest; Note: misdimension error

* Add: test_mapping-file and changed it to pytest; Note: WIP and issues with assertRaises

* Add: test_mapping-file finished; Note: Issues probably resolved

* Add: test_mfem_export-file and changed it to pytest; Note: error - super() has no attribute interfaces

* Add: test_multi_index-file and changed it to pytest

* Add: test_multipatch-file and changed it to pytest; Note: 3 errors due to super() has no attribute interfaces

* Add: test_normalize_knot_vectors-file and changed it to pytest

* Add: test_npz-file and changed it to pytest

* Add: test_order_manipulation and changed it to pytest

* Add: test_orientation-file and changed it to pytest

* Add: test_property_modification-file and changed it to pytest; Fix: raster and dim fixture in conftest-file

* Add: test_proximity-file and changed it to pytest

* Add: test_reparametrize-file and changed it to pytest

* Add: test_spline_constructors-file and changed it to pytest

* Fix: test_spline_constructors-file - typo in regex pattern resolved

* Add: test_spline_type_conversion-file and changed it to pytest

* Add: data-folder with svg-files and test_svg-file and changed it to pytest; Note: assert false

* Add: test_volume_integration-file and changed it to pytest

* Fix: removed getfixturevalue where unnecessary

* Fix: test_property_modification-file is using todict() now

* Fix: test_c_contiguous-file is using pytest.mark.parametrize and todict() now

* Fix: getting rid of all dict- and list-fixtures in conftest-file

* Fix: in conftest-file, are_items_close and -same fixtures simplified

* Fix: changed fixture-name get_queries_xD to queries_xD

* Fix: in test_mapping-file the pytest.raises-issue is solved now

* Add/Fix: copied data-folder from unittest

* Fix: test_multipatch-file assertions now with np.all

* Fix: test_kv_manipulation - removed unnecessary comment

* Add: in test_reparametrize-file, test_flip_axes-function was missing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* keep directory structure for tests

* remove SplineSetup

* simplify modifications

* RF: Remove Geometry class replace by fixtures

* RF: Fix paths in io test after directory changes

* RF: evaluation test with parameterize

* Add: worklow add pytest tests

* fix test_kv_manipulation

copy wasn't a copy

* RF: split big test into multiple smaller

* RF: better assert error message

* Fix: wrong message

* use parametrize for reference values

* update test name

* Update test_pytest/helpme/test_extract.py

* Fix: test package not installed

* split conversion tests

* Fix: in test_spline_constructors-file renamed testfunctions

* Add: test_multipatch-file had a missing code part

* Add: test_extract-file had a missing code part

* Add: test_gismo-file had missing code parts; Note: test fails

* fix random

* fix svg test

* remove unnecessary check

* Fix: work in the remoarks from last code review

* sync test_orientation

* sync test_multipatch and remove unrelated parts

* sync test_bezier_extraction

* Fix: Add floating point number comparison in text compare. Fixes the issue on some systems that the golden solution is not correct due to floating point erros.

* add test for #395

* add test for #407

* use pytest for testing

* replace unittest with pytest

* add cls._loge

* remove conftest from ignore list

* better specify test path

* add __init__.py

* add conftest.py

* add cd

* remove __all__ and udpate ci pytest call

* install dev mode

* Rf: remove pre python 3.8 exception to test due to those version not being supported anymore

---------

Co-authored-by: clemens.fricke <clemens.david.fricke@tuwien.ac.at>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jaewook Lee <jaewooklee042@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/cd Workflows for continuous integration and continuous delivery cibuildwheel-test Ask ci to test all wheel builds testing All about software testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants