Caoimhinmg / PmagPy

Python-based tools for Paleomagnetic research
scripps.ucsd.edu
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

move "choose data model" and "choose WD" to happen only after main frame exists #4

Closed moonshoes87 closed 7 years ago

moonshoes87 commented 7 years ago

Otherwise things break.

moonshoes87 commented 7 years ago

I have this basically solved, but I wanted to run through some tests before pushing these changes up. run_all_tests breaks on quite a few things for me.

First, I had to change:

for test in $(grep -rl --include \*.py "unittest" | grep -v "run_" | xargs); do

to

for test in $(grep -rl --include \*.py "unittest" . | grep -v "run_" | xargs); do

More importantly, the non-Framework build of Python error defeats every single GUI test. So to run tests on Mac with Anaconda, I needed to change:

python3 -m unittest $pytest >> test_output.log

to

pythonw -m unittest $pytest >> test_output.log

Not sure if that will cause a python2/python3 issue on some platform....

Also, looks like Demag GUI tests still don't work for Mac. At least, they appear to get stuck here: test_add_delete_fit (pmagpy_tests.test_demag_gui.TestDemagGUI) ...

I didn't want to mess too much with your script, but some tweaks may be needed for it to run through on Mac.

moonshoes87 commented 7 years ago

At this point, I have a solution that works for Pmag GUI. The problem is that it sort of breaks the Pmag GUI tests, I believe because it relies on wx.CallAfter to get the working directory and data model number.

Basically, not everything in init finishes before tests are hit, so we end up with some of this stuff:

wx._core.PyNoAppError: The wx.App object must be created first!

And it seg faults when finished running. Sigh.

This is irritating but can take a lower priority, I think. In my own testing, it seems to work with both data model 2 and 3, providing either or both WD and DM on the command line. @Caoimhinmg, would you mind having a look and verifying that the behavior seems right?

Caoimhinmg commented 7 years ago

Hey @moonshoes87, I'll have a look at the changes this morning. Sorry about the python3 bit of that script it's a Linux thing as most distributions come with both python2 and 3 pre-installed so the interpreters are named like that and the interpreter python is just the most recently used python. I'll see if your bash script runs on my distribution too as I didn't anticipate the grep changes.

Caoimhinmg commented 7 years ago

So the Demag GUI tests not running on Mac is something I might look at later once we've got the other stuff figured out for now it runs on Windows and Linux.

Pmag GUI tests work over here too without any of the mentioned errors. Though I do get some MagIC GUI test problems which I've raised an issue on. I also only seem to get a seg fault if a test fails on some error.

Most of the DM and WD selections seem to work well without any of the previously encountered errors in both data models. I like the solution you used for the DM selection. The WD selection now prompts the moment the GUI is opened, I like this personally but it is a change from the old method which just opened in CWD.

On the note of just manual testing all the GUIs seem to work fine on all of the datasets I tried. The functions I ran all worked good and it seems pretty stable.

moonshoes87 commented 7 years ago

Great! I will implement similar WD selection behavior into Magic GUI.