-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure testing framework (#123)
- each testing/projects/{project} is dynamically imported - provides definitions for expected class / file hierarchies - hierarchies are deep copied, tests that reuse previously mutated these - docs updated to use automodule, except `cpp with spaces` (not possible to document in sphinx) - ignore `from collections import MutableMapping` warnings (see also #119) - skip mac builds on CI until #122 is solved - install correct beautiful soup package in tox.ini - fix url parsing in docs/testproject.py
- Loading branch information
Showing
24 changed files
with
696 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,20 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
# os: [macos-latest, ubuntu-latest, windows-latest] | ||
# TODO: either obtain doxygen 1.8.20 on mac, or find out why everything | ||
# breaks in doxygen 1.9.2. | ||
os: [ubuntu-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
########################################################################## | ||
- name: Install Doxygen (macOS) | ||
if: contains(matrix.os, 'macos') | ||
run: | | ||
brew tap-new $USER/local-doxygen | ||
brew extract --version=1.8.20 doxygen $USER/local-doxygen | ||
HOMEBREW_NO_AUTO_UPDATE=1 brew install -v [email protected] | ||
# brew tap-new $USER/local-doxygen | ||
# brew extract --version=1.8.20 doxygen $USER/local-doxygen | ||
# HOMEBREW_NO_AUTO_UPDATE=1 brew install -v [email protected] | ||
HOMEBREW_NO_AUTO_UPDATE=1 brew install doxygen | ||
- name: Install Doxygen (Ubuntu) | ||
if: contains(matrix.os, 'ubuntu') | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Testing Projects Module | ||
======================================================================================== | ||
|
||
.. automodule:: testing.projects | ||
:members: | ||
|
||
`` testing.projects.c_maths`` Project | ||
---------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: testing.projects.c_maths | ||
:members: | ||
|
||
`` testing.projects.cpp with spaces`` Project | ||
---------------------------------------------------------------------------------------- | ||
|
||
.. module:: testing.projects.cpp_with_spaces | ||
|
||
This cannot be documented because it has spaces in the name and autodoc cannot | ||
complete its import. | ||
|
||
`` testing.projects.cpp_fortran_mixed`` Project | ||
---------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: testing.projects.cpp_fortran_mixed | ||
:members: | ||
|
||
`` testing.projects.cpp_func_overloads`` Project | ||
---------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: testing.projects.cpp_func_overloads | ||
:members: | ||
|
||
`` testing.projects.cpp_long_names`` Project | ||
---------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: testing.projects.cpp_long_names | ||
:members: | ||
|
||
`` testing.projects.cpp_nesting`` Project | ||
---------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: testing.projects.cpp_nesting | ||
:members: | ||
|
||
`` testing.projects.cpp_pimpl`` Project | ||
---------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: testing.projects.cpp_pimpl | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
The test projects used to evaluate exhale. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
The ``c_maths`` test project. | ||
""" | ||
|
||
from testing.hierarchies import directory, file, function, parameters | ||
|
||
|
||
def default_class_hierarchy_dict(): | ||
"""Return the default class hierarchy dictionary.""" | ||
return {} | ||
|
||
|
||
def default_file_hierarchy_dict(): | ||
"""Return the default file hierarchy dictionary.""" | ||
return { | ||
directory("include"): { | ||
file("c_maths.h"): { | ||
function("int", "cm_add"): parameters("int", "int"), | ||
function("int", "cm_sub"): parameters("int", "int") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" | ||
The ``cpp with spaces`` test project. | ||
""" | ||
|
||
from testing.hierarchies import directory, file, function, namespace, parameters | ||
|
||
|
||
def default_class_hierarchy_dict(): | ||
"""Return the default class hierarchy dictionary.""" | ||
return {} | ||
|
||
|
||
def default_file_hierarchy_dict(): | ||
"""Return the default file hierarchy dictionary.""" | ||
return { | ||
directory("include"): { | ||
directory("with spaces"): { | ||
file("with spaces.hpp"): { | ||
namespace("with_spaces"): { | ||
function("int", "value"): parameters() | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
The ``cpp_fortran_mixed`` test project. | ||
""" | ||
|
||
from testing.hierarchies import directory, file, function, namespace, parameters, variable | ||
|
||
|
||
def default_class_hierarchy_dict(): | ||
"""Return the default class hierarchy dictionary.""" | ||
return {} | ||
|
||
|
||
def default_file_hierarchy_dict(): | ||
"""Return the default file hierarchy dictionary.""" | ||
return { | ||
directory("include"): { | ||
directory("convert"): { | ||
file("convert.hpp"): { | ||
namespace("convert"): { | ||
function("T", "to_degrees", template=["typename T"]): parameters("T"), | ||
function("T", "to_radians", template=["typename T"]): parameters("T") | ||
} | ||
} | ||
} | ||
}, | ||
directory("src"): { | ||
file("conversions.f90"): { | ||
namespace("conversions"): { | ||
variable("real(c_float)", "pi_s"): {}, | ||
variable("real(c_double)", "pi_d"): {}, | ||
variable("real(c_float)", "s_180"): {}, | ||
variable("real(c_double)", "d_180"): {}, | ||
# NOTE: function parameters in fortran are a little weird. | ||
# 1. <type> has 'function', e.g. 'real(c_float) function' | ||
# 2. Parameters are names, not types? | ||
function("real(c_float) function", "degrees_to_radians_s"): parameters("degrees_s"), | ||
function("real(c_double) function", "degrees_to_radians_d"): parameters("degrees_d"), | ||
function("real(c_float) function", "radians_to_degrees_s"): parameters("radians_s"), | ||
function("real(c_double) function", "radians_to_degrees_d"): parameters("radians_d") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
""" | ||
The ``cpp_func_overloads`` test project. | ||
""" | ||
|
||
from testing.hierarchies import directory, file, function, namespace, parameters | ||
|
||
|
||
def default_class_hierarchy_dict(): | ||
"""Return the default class hierarchy dictionary.""" | ||
return {} | ||
|
||
|
||
def default_file_hierarchy_dict(): | ||
"""Return the default file hierarchy dictionary.""" | ||
return { | ||
directory("include"): { | ||
directory("overload"): { | ||
file("overload.hpp"): { | ||
function("int", "blargh"): parameters("int"), | ||
namespace("overload"): { | ||
# No args | ||
function("void", "blargh"): parameters(), | ||
# "pure" int overloads | ||
function("int", "blargh"): parameters("int"), | ||
function("int", "blargh"): parameters("int", "int"), | ||
function("int", "blargh"): parameters("int", "int", "int"), | ||
# "pure" float overloads | ||
function("float", "blargh"): parameters("float"), | ||
function("float", "blargh"): parameters("float", "float"), | ||
function("float", "blargh"): parameters("float", "float", "float"), | ||
# "pure" std::string overloads | ||
function("std::string", "blargh"): parameters("const std::string&"), | ||
function("std::string", "blargh"): parameters( | ||
"const std::string&", "const std::string&" | ||
), | ||
function("std::string", "blargh"): parameters( | ||
"const std::string&", "const std::string&", "const std::string&" | ||
), | ||
# absurd mixtures | ||
function("std::size_t", "blargh"): parameters("std::size_t", "const std::string&"), | ||
function("std::size_t", "blargh"): parameters( | ||
"std::size_t", "const float&", "double", "const std::string&" | ||
), | ||
# vector overloads | ||
function("void", "blargh"): parameters("std::vector<std::string>&"), | ||
function("void", "blargh"): parameters("std::vector<std::vector<int>>&"), | ||
# pointer style (spaces matter...) | ||
function("void", "blargh"): parameters( | ||
"const float *", "const float *", "float *", "std::size_t" | ||
), | ||
# templates | ||
function("C::type", "blargh", template=["class C"]): parameters("typename C::type"), | ||
# SFINAE is really pretty yeah? | ||
function( | ||
"std::enable_if<std::is_convertible<typename C::type, T>::value, T>::type", | ||
"blargh", | ||
template=["class C", "typename T"] | ||
): parameters("typename C::type"), | ||
function( | ||
"std::enable_if<!std::is_convertible<typename C::type, T>::value, T>::type", | ||
"blargh", | ||
template=["class C", "typename T"] | ||
): parameters("typename C::type") | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.