Skip to content

break handlers.jl into default_render, default_equality and preprocess #37

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

Merged
merged 5 commits into from
Oct 11, 2019

Conversation

johnnychen94
Copy link
Member

@johnnychen94 johnnychen94 commented Oct 6, 2019

This PR is a part of #36 that makes the overall pipeline cleaner. It's also a preparation for the introduction of @test_reference_broken and @test_reference_skip.

To avoid code duplication, codes in handler.jl are broken down into three functions:

  • default_render that infers the most appropriate render mode according to types of filename and actual. By default, it's BeforeAfterFull().
  • default_equality that infers the suitable equality compare method. By default, it's isequal.
  • preprocess that makes actual have the same type of reference.

@johnnychen94 johnnychen94 changed the title split out default_render and default_equality break handlers.jl into default_render, default_equality and preprocess Oct 6, 2019
src/core.jl Outdated
actual::T,
rendermode::Union{RenderMode, Nothing}=nothing,
equiv::Union{Function, Nothing}=nothing;
kw...) where T
Copy link
Member Author

Choose a reason for hiding this comment

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

Arguments order is changed because I made rendermode and equiv optional.

kw... are all passed to preprocess as it was (the only possible kw here is size for image type). It might be changed in the future, so I didn't document it.

@oxinabox
Copy link
Member

oxinabox commented Oct 6, 2019

What is the motivation of moving all this code out of its own file and intio core.jl?
Won't that make it harder to find things?

From the title I thought it was going to turn handlers.jl into 3 files:
rendered.jl equality_measures.jl and preprocessors.jl.

Aside: moving code and editting code makes for hard to follow diffs.

@johnnychen94
Copy link
Member Author

What is the motivation of moving all this code out of its own file and intio core.jl?

I'm planing to move test_reference and _test_reference from core.jl to test_reference.jl. After that, what are left in core.jl are other things related to the core pipeline.

@coveralls
Copy link

coveralls commented Oct 6, 2019

Coverage Status

Coverage decreased (-1.8%) to 82.857% when pulling ffa165a on johnnychen94:default into dcba05a on Evizero:master.

@johnnychen94 johnnychen94 changed the base branch from jc/pipeline to master October 6, 2019 13:13
@johnnychen94
Copy link
Member Author

@oxinabox I've tried to minimize the differences for you to review.

Since all codes in handlers.jl are removed and rewrite using default_rendermode, default_equality and preprocess. It's unavoidable hard to compare and review the diff. I've double-checked them and I'm confident about the logic here.

It comes to an end of my vacation, I need to focus on my school stuff first and then I'll come back continue it.

Since you prefer holding things apart in separate files, I'll move things related to RenderMode to render.jl when this PR is ready to be merged.

After this PR:

  • Documentation will be updated
  • implement Test-corresponding macros like @test_reference_broken, @test_reference_skip

@johnnychen94
Copy link
Member Author

johnnychen94 commented Oct 10, 2019

mind to take a look at it? 👀@oxinabox

Copy link
Member

@oxinabox oxinabox left a comment

Choose a reason for hiding this comment

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

I like it.
Just a few minor things

@johnnychen94
Copy link
Member Author

johnnychen94 commented Oct 11, 2019

The last three commits do a trivial organization work breaking core.jl into different files. You can review the difference commit by commit.

Copy link
Member

@oxinabox oxinabox left a comment

Choose a reason for hiding this comment

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

Nice

Bump the version (this is not breaking right? So patch)
and merge when ready,
then tag a release

_convert

To avoid code duplication, codes in `handler.jl` are broken down
into three functions:

* `default_rendermode` that infers the most appropriate render
   mode according to DataFormat and type of `actual`
* `default_equality` that infers the suitable equality compare
  method.
* `_convert` that converts `actual` so that it has the same type
  of `reference`.
@johnnychen94 johnnychen94 merged commit 46d650a into JuliaTesting:master Oct 11, 2019
@johnnychen94 johnnychen94 deleted the default branch December 14, 2019 21:08
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.

3 participants