Skip to content

Commit

Permalink
Doctestfix (#568)
Browse files Browse the repository at this point in the history
* merge

* better warning filter

* more doctest filters

* more robust against varying line breaks

* Remove double doctest

* get warning early

* fix sizedmatrix doctest error

Co-authored-by: Albin Heimerson <[email protected]>
  • Loading branch information
baggepinnen and albheim authored Nov 7, 2021
1 parent 7533957 commit bd2cfc2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,7 @@ jobs:
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- name: Test docs # Test are also run in the makedocs, but there they don't error properly unless we set strict in which case warnings also error
run: |
julia --project=docs -e '
ENV["PLOTS_TEST"] = "true"
ENV["GKSwstype"] = "nul"
using Documenter: doctest
using ControlSystems
doctest(ControlSystems)'
- name: Generate documentation
- name: Make documentation and run doctest
run: julia --project=docs --color=yes docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
StaticArrays = "0.12"
Documenter = "0.27.10"
8 changes: 7 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ println("Making docs")
makedocs(modules=[ControlSystems],
format=Documenter.HTML(),
sitename="ControlSystems.jl",
#strict=true,
strict=[
:doctest,
:linkcheck,
:parse_error,
# Other available options are
# :autodocs_block, :cross_references, :docs_block, :eval_block, :example_block, :footnote, :meta_block, :missing_docs, :setup_block
],
pages=[
"Home" => "index.md",
"Guide" => Any[
Expand Down
1 change: 1 addition & 0 deletions docs/src/examples/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DocTestSetup = quote
using ControlSystems, Plots
plotsDir = joinpath(dirname(pathof(ControlSystems)), "..", "docs", "build", "plots")
mkpath(plotsDir)
nyquistplot(ssrand(1,1,1)) # to get the warning for hover already here
save_docs_plot(name) = Plots.savefig(joinpath(plotsDir,name))
save_docs_plot(p, name) = Plots.savefig(p, joinpath(plotsDir,name))
end
Expand Down
3 changes: 2 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ DocTestFilters = [
r"HeteroStateSpace.+?\n"
r"TransferFunction.+?\n"
r"DelayLtiSystem.+?\n"
r"┌ Warning: Keyword argument hover.+?\n.+?\n" # remove next line as well
r"┌ Warning: Keyword argument hover.+\n*.+\n*" # remove next line as well
r"\[ Info: Precompiling.+\n*"
]
```

Expand Down
2 changes: 1 addition & 1 deletion docs/src/man/creating_systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ D =
Continuous-time state-space model
julia> HeteroStateSpace(sys, to_sized)
HeteroStateSpace{Continuous, SizedMatrix{2, 2, Int64, 2, Matrix{Int64}}, SizedMatrix{2, 1, Int64, 2, Matrix{Int64}}, SizedMatrix{1, 2, Int64, 2, Matrix{Int64}}, SizedMatrix{1, 1, Int64, 2, Matrix{Int64}}}
HeteroStateSpace{Continuous, SizedMatrix{2, 2, Int64, 2}, SizedMatrix{2, 1, Int64, 2}, SizedMatrix{1, 2, Int64, 2}, SizedMatrix{1, 1, Int64, 2}}
A =
-5 0
0 -5
Expand Down
2 changes: 1 addition & 1 deletion src/freqresp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function _bounds_and_features(sys::LTISystem, plot::Val)
w2 = ceil(fzp[end] + 1.2)
# Expand the range for nyquist plots
if plot isa Val{:nyquist}
w1 -= 1.0
w1 -= 0.0
w2 += 1.0
end
else
Expand Down

0 comments on commit bd2cfc2

Please sign in to comment.