Skip to content

Conversation

@benjeffery
Copy link
Member

Closes #657

WIP! Using PR for testing on WIN/OSX.

@AdminBot-tskit
Copy link
Collaborator

📖 Docs for this PR can be previewed here

@codecov
Copy link

codecov bot commented Oct 19, 2020

Codecov Report

Merging #909 into main will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #909      +/-   ##
==========================================
- Coverage   93.52%   93.47%   -0.05%     
==========================================
  Files          25       25              
  Lines       19963    20029      +66     
  Branches      790      796       +6     
==========================================
+ Hits        18671    18723      +52     
- Misses       1259     1272      +13     
- Partials       33       34       +1     
Impacted Files Coverage Δ
_tskitmodule.c 90.36% <0.00%> (-0.21%) ⬇️
tskit/trees.py 98.04% <0.00%> (-0.10%) ⬇️

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 160d107...95c1798. Read the comment docs.

@benjeffery benjeffery marked this pull request as ready for review October 19, 2020 11:17
@benjeffery
Copy link
Member Author

There seems to be an issue with codecov not showing files, so haven't checked coverage yet. Will look into it.

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

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

LGTM! I haven't pored over the details of the tricky stuff, but I assume this is derived from what we did in kastore, so I don't need to?

# SOFTWARE.
"""
Configuration and fixtures for pytest. Only put test-suite wide fixtures in here. Module
specific fixtures should live in their modules.
Copy link
Member

Choose a reason for hiding this comment

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

This is great! Can you just put in either a quick example of how to use these fixtures, or perhaps a link to the documentation from pytest for how this this is done?

Copy link
Member Author

Choose a reason for hiding this comment

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

@benjeffery
Copy link
Member Author

I assume this is derived from what we did in kastore, so I don't need to?

Yep, a lot of this was copied over.


# A tree sequence with data in all fields
@fixture(scope="session")
def ts():
Copy link
Member

Choose a reason for hiding this comment

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

This is great, but I worry a bit about attaching meaning to the (very commonly used) variable ts here. I can see this being confusing for people. What if we adopt a convention like having a suffix or prefix of fixture for these parameters? That might make things a bit more obvious.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this kind of magic can be really confusing if you aren't aware what it going on. It seemed a bit much to put a suffix on, but when I think about the reader of the code it really does help. I've added them in b0b566b

Copy link
Member

Choose a reason for hiding this comment

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

I agree, it feels a bit wordy in the code, but I think it'll help people who aren't used to using pytest.

@fixture(scope="session")
def multi_ts():
return [msprime.simulate(i, random_seed=42) for i in range(2, 100, 5)]
def multi_ts(ts):
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit vague, as I'd imagine we'll want all sorts of different fixtures like this. What about replicate_ts_fixture which will return a list of msprime replicate sims?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in b0b566b

@jeromekelleher
Copy link
Member

LGTM, merge away whenever!

@mergify mergify bot merged commit d3b7cf2 into tskit-dev:main Oct 20, 2020
@benjeffery benjeffery mentioned this pull request Oct 21, 2020
@benjeffery benjeffery deleted the file-objects branch November 10, 2020 22:33
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.

File objects for Python dump/load

3 participants