Skip to content

Commit

Permalink
Allow testing of just a single file (#3511)
Browse files Browse the repository at this point in the history
* allow testing of just a single file

* simplify

* remove debug statements

* remove debug statements

* add comment

* add remark in Contributors guide for how to run a single test file
  • Loading branch information
navidcy committed Mar 20, 2024
1 parent 9f3f8e6 commit f98c952
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
17 changes: 11 additions & 6 deletions docs/src/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Discussions are recommended for asking questions about (for example) the user in

* Note: for small or minor changes (such as fixing a typo in documentation), the [GitHub editor](https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/editing-files-in-your-repository) is super useful for forking and opening a pull request with a single click.

* Write your code with love and care. In particular, conform to existing Oceananigans style and formatting conventions. For example, we love verbose and explicit variable names, use `TitleCase` for types, `snake_case` for objects, and always.put.spaces.after.commas. For formatting decisions we loosely follow the [YASGuide](https://github.com/jrevels/YASGuide). It's worth few extra minutes of our time to leave future generations with well-written, readable code.
* Write your code with love and care. In particular, conform to existing Oceananigans style and formatting conventions. For example, we love verbose and explicit variable names, use `TitleCase` for types, `snake_case` for objects, and always,put,spaces.after.commas,or.periods. For formatting decisions we loosely follow the [YASGuide](https://github.com/jrevels/YASGuide). It's worth few extra minutes of our time to leave future generations with well-written, readable code.

## What is a "collaborator" and how can I become one?

* Collaborators have permissions to review pull requests and status allows a contributor to review pull requests in addition to opening them. Collaborators can also create branches in the main Oceananigans repository.
* Collaborators have permissions to review pull requests and status allows a contributor to review pull requests in addition to opening them. Collaborators can also create branches in the main Oceananigans repository.

* We ask that new contributors try their hand at forking Oceananigans, and opening and merging a pull request before requesting collaborator status.

Expand Down Expand Up @@ -122,12 +122,17 @@ Oceananigans or by requesting something you think is missing.

* Create the development environment by opening Julia via `julia --project` then
typing in `] instantiate`. This will install all the dependencies in the Project.toml
file.
file. Your development environment is now ready!

* You can test to make sure Oceananigans works by typing in `] test`. Doing so will run all
the tests (and this can take a while).
* You can test to make sure Oceananigans works by typing in `] test`. (This is equivalent to
`using Pkg; Pkg.test()`.) Doing so will run all the tests (and this can take a while).
Alternatively, you can run only one test script file by providing its name as an environment
variable. For example, to run the tests only from the `test_coriolis.jl` file we call:

```
$ TEST_FILE=test_coriolis.jl julia --project -e"using Pkg; Pkg.test()"
```

Your development environment is now ready!

## Pull Requests

Expand Down
12 changes: 0 additions & 12 deletions test/dependencies_for_runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ Logging.global_logger(OceananigansLogger())
##### Testing parameters
#####

float_types = (Float32, Float64)

closures = (
:ScalarDiffusivity,
:ScalarBiharmonicDiffusivity,
Expand All @@ -68,15 +66,5 @@ closures = (
:ConvectiveAdjustmentVerticalDiffusivity,
)

#####
##### Run tests!
#####

float_types = (Float32, Float64)

include("utils_for_runtests.jl")

archs = test_architectures()

group = get(ENV, "TEST_GROUP", :all) |> Symbol
test_file = get(ENV, "TEST_FILE", :none) |> Symbol
17 changes: 17 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
include("dependencies_for_runtests.jl")

float_types = (Float32, Float64)
archs = test_architectures()

group = get(ENV, "TEST_GROUP", :all) |> Symbol
test_file = get(ENV, "TEST_FILE", :none) |> Symbol

# if we are testing just a single file then group = :none
# to skip the full test suite
if test_file != :none
group = :none
end


#####
##### Run tests!
#####

CUDA.allowscalar() do

@testset "Oceananigans" begin
Expand Down

0 comments on commit f98c952

Please sign in to comment.