Skip to content

Commit

Permalink
Make doctests part of Pkg.test("Oscar") (#1768)
Browse files Browse the repository at this point in the history
* Make doctests part of Pkg.test()

* tests: fix global state for doctests (#1769)

* tests: reset abelian_closure variable name after printing test

* tests: StraightLinePrograms put tests in submodule to avoid polluting main namespace too much
  • Loading branch information
thofma committed Nov 28, 2022
1 parent 0023b0a commit cbd47bc
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 50 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,6 @@ jobs:
run: echo "OMP_NUM_THREADS=1" >> $GITHUB_ENV
- name: "Run tests"
uses: julia-actions/julia-runtest@latest
- name: "Run doctests"
if: ${{ matrix.julia-version == '1.6' }}
run: |
julia --project=docs --color=yes --code-coverage -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
using Documenter
using Oscar
DocMeta.setdocmeta!(Oscar, :DocTestSetup, :(using Oscar, Oscar.Graphs); recursive = true)
doctest(Oscar)'
- name: "Process code coverage"
uses: julia-actions/julia-processcoverage@v1
with:
Expand Down
7 changes: 7 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ RandomExtensions = "0.4.3"
RecipesBase = "1.2.1"
Singular = "0.14.0"
julia = "1.6"

[extras]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Documenter"]
4 changes: 2 additions & 2 deletions experimental/GaloisGrp/GaloisGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ function starting_group(GC::GaloisCtx, K::T; useSubfields::Bool = true) where T
# the re-ordering is easy: W^s for s = vcat(bs)
bs = map(x->findall(isequal(x), d), r)
@assert all(x->length(x) == length(bs[1]), bs)
W = isomorphic_perm_group(wreath_product(symmetric_group(length(bs[2])), g))[1]
W = PermGroup(wreath_product(symmetric_group(length(bs[2])), g))
#should have the block system as above..
W = W^symmetric_group(degree(W))(vcat(bs...))
G = intersect(G, W)[1]
Expand Down Expand Up @@ -2401,7 +2401,7 @@ function galois_ideal(C::GaloisCtx, extra::Int = 5)
if C.start[1] == 1 # start with intersection of wreath products
_, g = slpoly_ring(ZZ, n)
for bs = C.start[2]
W = isomorphic_perm_group(wreath_product(symmetric_group(length(bs[1])), symmetric_group(length(bs))))[1]
W = PermGroup(wreath_product(symmetric_group(length(bs[1])), symmetric_group(length(bs))))
W = W^symmetric_group(n)(vcat(bs...))
G = intersect(G, W)[1]
#each subfield causes, possibly, several invariants...
Expand Down
35 changes: 0 additions & 35 deletions src/Groups/homomorphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ export
is_invertible,
is_isomorphic,
is_isomorphic_with_map,
isomorphic_fp_group,
isomorphic_pc_group,
isomorphic_perm_group,
isomorphism,
is_surjective,
kernel,
Expand Down Expand Up @@ -696,38 +693,6 @@ function (::Type{T})(G::GrpGen) where T <: GAPGroup
return codomain(isomorphism(T, G))
end

################################################################################
#
# provide and deprecate the old syntax
#
function _isomorphic_perm_group(G::GAPGroup)
f = isomorphism(PermGroup, G)
return codomain(f), f
end

@deprecate isomorphic_perm_group(G::GAPGroup) _isomorphic_perm_group(G)

function _isomorphic_pc_group(G::GAPGroup)
f = isomorphism(PcGroup, G)
return codomain(f), f
end

@deprecate isomorphic_pc_group(G::GAPGroup) _isomorphic_pc_group(G)

function _isomorphic_fp_group(G::GAPGroup)
f = isomorphism(FPGroup, G)
return codomain(f), f
end

@deprecate isomorphic_fp_group(G::GAPGroup) _isomorphic_fp_group(G)

function _isomorphic_group(::Type{T}, G::GAPGroup) where T <: GAPGroup
fmap = isomorphism(T, G)
return codomain(fmap), fmap
end

@deprecate isomorphic_group(::Type{T}, G::GAPGroup) where T <: GAPGroup _isomorphic_group(T, G)


"""
simplified_fp_group(G::FPGroup)
Expand Down
4 changes: 2 additions & 2 deletions src/ToricVarieties/ToricMorphisms/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export morphism_on_torusinvariant_weil_divisor_group


@doc Markdown.doc"""
morphism_on_cartier_divisor_group(tm::ToricMorphism)
morphism_on_torusinvariant_cartier_divisor_group(tm::ToricMorphism)
For a given toric morphism `tm`, this method computes the corresponding
map of the Cartier divisors.
Expand All @@ -124,7 +124,7 @@ map of the Cartier divisors.
julia> F4 = hirzebruch_surface(4)
A normal, non-affine, smooth, projective, gorenstein, non-fano, 2-dimensional toric variety without torusfactor
julia> morphism_on_cartier_divisor_group(ToricIdentityMorphism(F4))
julia> morphism_on_torusinvariant_cartier_divisor_group(ToricIdentityMorphism(F4))
Map with following data
Domain:
=======
Expand Down
3 changes: 3 additions & 0 deletions test/Rings/AbelianClosure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ end

a = @inferred root_of_unity(K, 4)
@test isone(a^4) && !isone(a) && !isone(a^2)

# reset variable for any subsequent (doc-)tests
set_variable!(K, "ζ")
end

@testset "Coercion" begin
Expand Down
8 changes: 8 additions & 0 deletions test/StraightLinePrograms/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# avoid polluting the main namespace to to preserve proper printing in doctests
module SLPTest
using ..Test
using ..Oscar
using ..Oscar: SLP

include("setup.jl")
include("straightline.jl")
include("gap.jl")
include("atlas.jl")

end
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Oscar
using Test
using Documenter


import Oscar.Nemo.AbstractAlgebra
include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl"))
Expand Down Expand Up @@ -45,3 +47,15 @@ include("TropicalGeometry/runtests.jl")
include("Serialization/runtests.jl")

include("StraightLinePrograms/runtests.jl")

# Doctests

# We want to avoid running the doctests twice so we skip them when
# "oscar_run_doctests" is set by OscarDevTools.jl
if v"1.6.0" <= VERSION < v"1.7.0" && !haskey(ENV,"oscar_run_doctests")
@info "Running doctests (Julia version is 1.6)"
DocMeta.setdocmeta!(Oscar, :DocTestSetup, :(using Oscar, Oscar.Graphs); recursive = true)
doctest(Oscar)
else
@info "Not running doctests (Julia version must be 1.6)"
end

0 comments on commit cbd47bc

Please sign in to comment.