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

Python unittest enhancements and source documentation #60

Open
wants to merge 14 commits into
base: femdev
Choose a base branch
from

Conversation

ceeli
Copy link

@ceeli ceeli commented Aug 26, 2019

This pull request includes changes concerning all of FreeCAD (inside the Mod/Test module) and changes that concern mainly the fem module. See the source/file documentation for more info on the new modules.

There are new test support modules for App tests (AppTestSupport) and Gui tests (GuiTestSupport) in the Mod/Test module. This should be useful for all of FreeCADs python unit tests.

Test modules are now in sub packages of the femtest package. femtest.app contains all test modules which don't need a gui to run. femtest.gui contains all tests that require a gui to run. The test files are in femtest/data. The packages use the load_tests protocol so they can be used as targets when executing tests (e.g. FreeCADCmd -t femtest). This could replace the TestFem module. The packages automatically find all test (they don't need to be listed again).

Test coverage of the python source can now be measured by using the --cov option in addition to the -t option. See the documentation of src/App/FreeCADTest for more detail. coverage.py must be installed.

I don't expect that this pull request is just merged without some tweaking. I'll be available for at least a month and I intend to work on testing and documentation of FreeCAD for much longer than that. This branch doesn't work properly with python2. Is that still a requirement?

@ceeli ceeli changed the base branch from master to femdev August 26, 2019 14:07
@berndhahnebach
Copy link
Owner

This branch doesn't work properly with python2. Is that still a requirement?

AFAIK for 0.19 yes. Even if we force developer and user to use Python 3

On all other stuff. I will have a look and give some feedback.

@berndhahnebach
Copy link
Owner

Since it help s a test module and it is new I do not think we need py2 support. The time we need to get all this into FC py2 might be obsolete.

It will take some time, but we need to get started somdhow ... Lets do a simple one. I saw you moved from testfiles to data directory. Is it posible to extract this to a separete commit? I would just merge this into master.

@berndhahnebach
Copy link
Owner

damn lots of merge conflicts ...

@berndhahnebach
Copy link
Owner

berndhahnebach commented Sep 21, 2019

Would it be possible to split it in two PRs one only FEM related commits? We could these merge really easily. But the not FEM related test commits needs to be disscussed first. It would even be much simpler to disscuss these commits if they would be without all these FEM changes. The FEM changes need only to be reviewed from my side. I even can merge them into master directly.

It is really a pity I have been overoveroverloaded last few month ...

there is some cools stuff inside ...

cheers bernd

@berndhahnebach
Copy link
Owner

berndhahnebach commented Sep 21, 2019

if you replace a print with a FreeCAD.Console.PrintWhatever you need to add a new line because it is not added like print it does.

BTW: this replacement is one of the last remaining FEM code formating.

Have you noticed https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Fem/coding_conventions.md

@ceeli
Copy link
Author

ceeli commented Sep 21, 2019

Alright lets do this. First let me check where all those merge conflicts come from. There haven't been any a few weeks ago.

@berndhahnebach
Copy link
Owner

berndhahnebach commented Sep 21, 2019

mainly my code formmating replacing all ' by "

@ceeli
Copy link
Author

ceeli commented Sep 21, 2019

Oh, thats troublesome... I think I have to resolve all that by hand than. Well, I'll be back in an hour or so :P

@ceeli
Copy link
Author

ceeli commented Sep 21, 2019

Alright I resolved everything. I couldn't test anything cause my FreeCAD build need to completely recompile which takes ~30min on my notebook.

@berndhahnebach
Copy link
Owner

cool I will have a look. I allready saw some commits I would like to cherry-pick. Have you seen https://forum.freecadweb.org/viewtopic.php?t=36682

@berndhahnebach
Copy link
Owner

still there are lots of problems in the rebase I solve a few here ... hopefully ... FreeCAD#2549

@ceeli
Copy link
Author

ceeli commented Sep 23, 2019

I know I'm solving them right now. Those are just some merge mistakes.

@berndhahnebach
Copy link
Owner

I merged all changes not related to your new test suite. cd8f0e0

@berndhahnebach
Copy link
Owner

I had to splitt some commits. Hopefully you get it all together again.

@berndhahnebach
Copy link
Owner

btw: somehow your github email does not fit with your git email. AFAIK you could even set it to some strange mail just to get you found in github as a contributor

@berndhahnebach
Copy link
Owner

How about a rebase Markus?

@ceeli
Copy link
Author

ceeli commented Sep 30, 2019

Yes, will do. I'm quite busy atm sorry... I'll do it tomorrow.

@berndhahnebach
Copy link
Owner

AFAIKT you should only have changes left in the regard of the new test tool, means new code and only a few code changes. Most of the code changes ATM are changes which change stuff back to how it was in summer.

cheers bernd

@berndhahnebach
Copy link
Owner

ping

@ceeli
Copy link
Author

ceeli commented Oct 15, 2019

Still here, just very busy with studying, sorry... I'll going to look though it now

@berndhahnebach
Copy link
Owner

berndhahnebach commented Oct 21, 2019

I did a rebase. Would you give this a try? https://github.com/berndhahnebach/FreeCAD_bhb/commits/gsoctestpy2

do not forget the 2 at branch end

@berndhahnebach
Copy link
Owner

made some code formatting and added some licence header.

@berndhahnebach
Copy link
Owner

something is broken in the old FEM tests! How do I run the new FEM tests?

Should we move disscussion to the forum?

@ceeli
Copy link
Author

ceeli commented Oct 22, 2019

I have a few hours to spare today. Please don't apply anything (from the GSoC Stuff) to femdev otherwise I have to start over again.

@berndhahnebach
Copy link
Owner

I have a few hours to spare today. Please don't apply anything (from the GSoC Stuff) to femdev otherwise I have to start over again.

For sure I will not :-)

I cherry picked your commits. It took me just half an hour. See https://github.com/berndhahnebach/FreeCAD_bhb/commits/gsoctestpy2

@ceeli
Copy link
Author

ceeli commented Oct 23, 2019

I have a few hours to spare today. Please don't apply anything (from the GSoC Stuff) to femdev otherwise I have to start over again.

For sure I will not :-)

I cherry picked your commits. It took me just half an hour. See https://github.com/berndhahnebach/FreeCAD_bhb/commits/gsoctestpy2

Thanks! The rebase is now finished and for me everything works. I just pulled the changes from yesterday and today and for some reason the recompile takes quite long now. I have to go to work now but when I come home I'll do one test run and if everything works I'll push it. It took a little longer because I also fixed stuff and cleaned up the history a bit.

The support module provides base classes for FreeCAD unittest TestCase classes.
It does stuff like providing FreeCAD specific asserts and automatic document
management.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants