lmaurits / BEASTling

A linguistics-focussed command line tool for generating BEAST XML files.
BSD 2-Clause "Simplified" License
20 stars 6 forks source link

ported tests to pytest #237

Closed xrotwang closed 5 years ago

xrotwang commented 5 years ago

I de-activated the assertions for the currently failing beastrun tests, see #235

codecov-io commented 5 years ago

Codecov Report

Merging #237 into master will decrease coverage by 93.58%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #237       +/-   ##
=========================================
- Coverage   93.58%     0%   -93.59%     
=========================================
  Files          25     24        -1     
  Lines        2917   2915        -2     
=========================================
- Hits         2730      0     -2730     
- Misses        187   2915     +2728
Impacted Files Coverage Δ
beastling/fileio/datareaders.py 0% <0%> (-89.95%) :arrow_down:
beastling/clocks/random.py 0% <0%> (-100%) :arrow_down:
beastling/clocks/relaxed.py 0% <0%> (-100%) :arrow_down:
beastling/clocks/strict.py 0% <0%> (-100%) :arrow_down:
beastling/beast_maps.py 0% <0%> (-100%) :arrow_down:
beastling/treepriors/coalescent.py 0% <0%> (-100%) :arrow_down:
beastling/models/mk.py 0% <0%> (-100%) :arrow_down:
beastling/clocks/baseclock.py 0% <0%> (-100%) :arrow_down:
beastling/models/covarion.py 0% <0%> (-98.44%) :arrow_down:
beastling/treepriors/base.py 0% <0%> (-98.42%) :arrow_down:
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 072de64...c598875. Read the comment docs.

codecov-io commented 5 years ago

Codecov Report

Merging #237 into master will decrease coverage by 93.58%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #237       +/-   ##
=========================================
- Coverage   93.58%     0%   -93.59%     
=========================================
  Files          25     24        -1     
  Lines        2917   2915        -2     
=========================================
- Hits         2730      0     -2730     
- Misses        187   2915     +2728
Impacted Files Coverage Δ
beastling/fileio/datareaders.py 0% <0%> (-89.95%) :arrow_down:
beastling/clocks/random.py 0% <0%> (-100%) :arrow_down:
beastling/clocks/relaxed.py 0% <0%> (-100%) :arrow_down:
beastling/clocks/strict.py 0% <0%> (-100%) :arrow_down:
beastling/beast_maps.py 0% <0%> (-100%) :arrow_down:
beastling/treepriors/coalescent.py 0% <0%> (-100%) :arrow_down:
beastling/models/mk.py 0% <0%> (-100%) :arrow_down:
beastling/clocks/baseclock.py 0% <0%> (-100%) :arrow_down:
beastling/models/covarion.py 0% <0%> (-98.44%) :arrow_down:
beastling/treepriors/base.py 0% <0%> (-98.42%) :arrow_down:
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 072de64...c598875. Read the comment docs.

lmaurits commented 5 years ago

So what do I run to do these tests locally instead of my old nosetests?

xrotwang commented 5 years ago

You install all test/dev requirements running pip install -r requirements.txt, and then simply pytest. Arguments for pytest are configured in setup.cfg.

lmaurits commented 5 years ago

Okay, I'm officially Pleased as Punch with this! I just did a pytest tests/fileio_tests.py and it only ran the tests in that file and then quit. Even though I'm, heaven forbid, not in a virtualenv! This sounds like a ludicrously straightforward thing to get excited about, but literally none of our previous test setups have worked like this for me.

xrotwang commented 5 years ago

I think the test files got a lot simpler, too. So I'd say that's a good basis to move forward.

If you don't have stuff to fold into beastling right now, I'd have a go at removing all PY2 compat stuff, so we can startout with an even leaner codebase.

lmaurits commented 5 years ago

Nope, nothing to fold in for now. Even though we now have validate_ids() in place, I'd like to start shifting toward a system where a lot of these IDs are generated programmatically, rather than being handwritten. So I'm liable to be thinking about big future overhauls for a while, rather than hacking in random little bits and pieces. In other words, this is a fine time to have a go at killing PY2.

xrotwang commented 5 years ago

Are you ok with also rolling in some xml creation refactoring?

lmaurits commented 5 years ago

Hmm, what did you have in mind?

xrotwang commented 5 years ago

I just wanted to replace all the ET.SubElement or ET.Element calls with calling a utility function, which can add some syntactic sugar to

And add explicit element functions named after the tag names to an xml module, so that the tab-completion in the IDE prevents mistyping tag names.

lmaurits commented 5 years ago

Okay, sounds good!

xrotwang commented 5 years ago

Btw. looking over all instances of ET.SubElement calls, I noticed one where a tag dist was created - not distr or distribution. Dunno if that's a bug, but it was the only instance such a tag was created.

xrotwang commented 5 years ago

And now I can ask the IDE to show all places where xml.dist was used - and can easily refactor if that's a bug.

lmaurits commented 5 years ago

If it's in the BSVS model, for an operator, then it's correct.