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

Fix option handling in pipeline.jl #70

Merged
merged 9 commits into from
Aug 9, 2024

Conversation

suvayu
Copy link
Member

@suvayu suvayu commented Aug 8, 2024

Resolves the confusion among the options.

The only "automatic" behaviour is when the source is a file, and no table name has been provided. In that case, it generates a table name by removing special characters from the filename. If tmp=true, the generated table name has a t_* prefix.

name tmp remarks
non-empty as provided
empty true table name: t_<safe_filename>
empty false table name: <safe_filename>

All other options work independently:

  • name::String sets the table name
  • tmp::Bool creates the table as a temporary in-memory table
  • show::Bool returns the created table as a dataframe

Also refactor most of the test suite to isolated tests as much as possible. Some are unavoidable, since they need some existing state (e.g. a base table), and there is no nice way to do fixtures.

Related issues

Closes #31

Checklist

  • I am following the contributing guidelines
  • Tests are passing
  • Lint workflow is passing
  • Docs were updated and workflow is passing

Copy link

codecov bot commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.14%. Comparing base (78646dd) to head (06d82e3).

Files Patch % Lines
src/pipeline.jl 83.33% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
+ Coverage   68.86%   69.14%   +0.28%     
==========================================
  Files           7        7              
  Lines         273      269       -4     
==========================================
- Hits          188      186       -2     
+ Misses         85       83       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@abelsiqueira abelsiqueira left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I've made a few, mostly small, comments.
There are some new lines not covered in the tests (when length(name) == 0), e.g., in set_tbl_col. Can you add a small test for these too?
Otherwise, looks good to me.

src/pipeline.jl Outdated Show resolved Hide resolved
src/pipeline.jl Outdated Show resolved Hide resolved
src/pipeline.jl Show resolved Hide resolved
src/pipeline.jl Outdated Show resolved Hide resolved
src/pipeline.jl Outdated Show resolved Hide resolved
test/test-pipeline.jl Outdated Show resolved Hide resolved
test/test-pipeline.jl Outdated Show resolved Hide resolved
src/pipeline.jl Show resolved Hide resolved
src/pipeline.jl Outdated Show resolved Hide resolved
src/pipeline.jl Show resolved Hide resolved
@abelsiqueira
Copy link
Member

Oh yeah, also, can you update the title of the PR? Thanks!

@suvayu
Copy link
Member Author

suvayu commented Aug 9, 2024

There are some new lines not covered in the tests (when length(name) == 0), e.g., in set_tbl_col

Is there a way I can run the coverage tool and generate the report locally?

@suvayu suvayu changed the title 31 name tmp show Fix option handling in create_tbl & set_tbl_col Aug 9, 2024
@suvayu suvayu changed the title Fix option handling in create_tbl & set_tbl_col Fix option handling in pipeline.jl Aug 9, 2024
@abelsiqueira
Copy link
Member

There are some new lines not covered in the tests (when length(name) == 0), e.g., in set_tbl_col

Is there a way I can run the coverage tool and generate the report locally?

Yes, you can use the LocalCoverage.jl package. I don't remember exactly the api, but there is some functions with generate or something like that in the name.

@abelsiqueira
Copy link
Member

It's

pkg> activate
pkg> add LocalCoverage

taken from https://github.com/TulipaEnergy/TulipaEnergyModel.jl/blob/main/README.dev.md

@abelsiqueira
Copy link
Member

Then

julia> using LocalCoverage
# ]
pkg> activate .
# <backspace>
julia> cov = generate_coverage()

@suvayu
Copy link
Member Author

suvayu commented Aug 9, 2024

I don't see any html files. I was hoping to see the line-by-line coverage. Anyway, I can wait for the coverage bot.

@abelsiqueira
Copy link
Member

I think our docs are incomplete or I didn't copy-paste enough. There is more info here: https://github.com/JuliaCI/LocalCoverage.jl?tab=readme-ov-file#optional-dependencies
You will need to install lcov to visualize it, apparently.

abelsiqueira
abelsiqueira previously approved these changes Aug 9, 2024
Copy link
Member

@abelsiqueira abelsiqueira left a comment

Choose a reason for hiding this comment

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

Thanks for the update. I've made small code formatting comments, mostly for consistency. Though I am fine either way.

I've also mentioned where the code coverage is failing. On the "Files changes" tab you can see the codecov warnings. That being said, we already have #28 to keep track of the missing coverage, so I am fine with merging this.

Everything else look good, so I will approve it.

src/pipeline.jl Outdated Show resolved Hide resolved
src/pipeline.jl Outdated Show resolved Hide resolved
src/pipeline.jl Outdated Show resolved Hide resolved
src/pipeline.jl Outdated Show resolved Hide resolved
Co-authored-by: Abel Soares Siqueira <[email protected]>
@suvayu
Copy link
Member Author

suvayu commented Aug 9, 2024

I've also mentioned where the code coverage is failing. On the "Files changes" tab you can see the codecov warnings. That being said, we already have #28 to keep track of the missing coverage, so I am fine with merging this.

Also, these are all in set_tbl_col, and I'm working on #34.

@suvayu suvayu merged commit 6fb0423 into TulipaEnergy:main Aug 9, 2024
6 checks passed
@suvayu suvayu deleted the 31_name_tmp_show branch September 9, 2024 07:12
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.

Refactor use of name, tmp, show triplet
2 participants