-
Notifications
You must be signed in to change notification settings - Fork 67
tests: use an easy to include setup file #541
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
Conversation
When wanting to run a specific test/testset, it's easy to copy-pase it into the REPL, but it can be annoying to find the setup-code, like constants or functions defined usually at the top of the test file. All this setup code is here put in test/setup.jl, so that it's always predictable (and easy) what one has to do to inject to required dependencies in the REPL: `include("test/setup.jl")`.
In Hecke (and possibly Nemo) we implemented
Hecke.test_module(file, false)
or similar, running only that file in the same session...
…On Wed, Nov 27, 2019 at 06:10:27AM -0800, Rafael Fourquet wrote:
When wanting to run a specific test/testset, it's easy to copy-pase it
into the REPL, but it can be annoying to find the setup-code, like
constants or functions defined usually at the top of the test file.
All this setup code is here put in test/setup.jl, so that it's always
predictable (and easy) what one has to do to inject to required
dependencies in the REPL: `include("test/setup.jl")`.
Another nice thing to have is to be able to run one single test file. But it's currently not always supported (e.g. `include("test/generic/Matrix-test.jl")` won't work). So I also propose to conditionally include the "setup.jl" file at the top of test files (which need setup), so that they can be run independently. I currently did it only for "Matrix-test.jl" and will continue if the idea is supported. This looks like
```julia
if ***@***.*** SETUP
include("../setup.jl")
end
```
You can view, comment on, or merge this pull request online at:
#541
-- Commit Summary --
* tests: use an easy to include setup file
* conditionally include setup.jl for individual file loading
-- File Changes --
M test/AbstractAlgebra-test.jl (4)
M test/Modules-test.jl (20)
M test/generic/DirectSum-test.jl (2)
M test/generic/Map-test.jl (11)
M test/generic/Matrix-test.jl (160)
M test/generic/MatrixAlgebra-test.jl (78)
M test/generic/Module-test.jl (15)
M test/generic/Perm-test.jl (2)
M test/runtests.jl (12)
A test/setup.jl (230)
-- Patch Links --
https://github.com/Nemocas/AbstractAlgebra.jl/pull/541.patch
https://github.com/Nemocas/AbstractAlgebra.jl/pull/541.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#541
|
Yes, I had a similar idea for a future PR, mimicking what is available in Julia: |
On Wed, Nov 27, 2019 at 06:30:55AM -0800, Rafael Fourquet wrote:
Yes, I had a similar idea for a future PR, mimicking what is available in Julia: `Base.runtests(list_of_test_names)`.
Difference being that "our" version can run selected tests in the same
julia or not.
runtests can not
… --
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#541 (comment)
|
I noticed yes. I can see the usefulness of "in the same julia" when hacking a routine at the REPL and having the tests take the changes into account immediately, do you have another use case? |
On Wed, Nov 27, 2019 at 07:41:13AM -0800, Rafael Fourquet wrote:
> Difference being that "our" version can run selected tests in the same julia or not.
I noticed yes. I can see the usefulness of "in the same julia" when hacking a routine at the REPL and having the tests take the changes into account immediately, do you have another use case?
Yes/ no:
using global assignments one can recover intermediate results in failing
tests to invesigate them in the REPL.
So its more of the same...
… --
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#541 (comment)
|
Addtionally, it is faster since you don't have to compile everything over and over again. |
Makes sense, thanks. |
The problem this was trying to address is mostly solved for me with |
When wanting to run a specific test/testset, it's easy to copy-pase it
into the REPL, but it can be annoying to find the setup-code, like
constants or functions defined usually at the top of the test file.
All this setup code is here put in test/setup.jl, so that it's always
predictable (and easy) what one has to do to inject to required
dependencies in the REPL:
include("test/setup.jl")
.Another nice thing to have is to be able to run one single test file. But it's currently not always supported (e.g.
include("test/generic/Matrix-test.jl")
won't work). So I also propose to conditionally include the "setup.jl" file at the top of test files (which need setup), so that they can be run independently. I currently did it only for "Matrix-test.jl" and will continue if the idea is supported. This looks like