Открыть боковую панель
nikitronn
sverchok
Коммиты
35956091
Коммит
35956091
создал
Окт 18, 2019
по автору
Ilya Portnov
Просмотр файлов
Test documentation references consistence.
владелец
d43132c8
Изменения
16
Скрыть пробелы
Построчно
Рядом
docs/nodes/alpha_nodes/alpha_nodes_index.rst
Просмотр файла @
35956091
...
...
@@ -5,6 +5,6 @@ Alpha Nodes
.. toctree::
:maxdepth: 2
offset_line
contour2D
planar_edgenet_to_polygons
armature_analyzer
lattice_analyzer
docs/nodes/analyzers/analyzers_index.rst
Просмотр файла @
35956091
...
...
@@ -6,7 +6,7 @@ Analyzers
:maxdepth: 2
area
bbox
bbox
_mk2
diameter
distance_pp
distance_point_line
...
...
@@ -32,5 +32,5 @@ Analyzers
points_inside_mesh
polygons_centers
polygons_centers_mk3
raycast
volume
raycaster_lite
docs/nodes/beta_nodes/beta_nodes_index.rst
Просмотр файла @
35956091
...
...
@@ -12,4 +12,8 @@ Beta Nodes
sample_uv_color
color_by_formula
spiralNode
unsubdivide
deform_by_formula
extrude_separate_lite
subdivide_lite
docs/nodes/generator/generator_index.rst
Просмотр файла @
35956091
...
...
@@ -11,8 +11,9 @@ Generators
bricks
circle
cylinder
cylinder_mk2
image
line_mk
2
line_mk
3
ngon
plane_mk2
random_vector_mk2
...
...
docs/nodes/generators_extended/generators_extended_index.rst
Просмотр файла @
35956091
...
...
@@ -11,9 +11,10 @@ Generators Extended
hilbert
hilbert3d
hilbert_image
hexa
_grid
_mk1
polygon
_grid
image_components
profile_mk2
profile_mk3
regular_solid
mesh_eval
ring
...
...
@@ -22,4 +23,6 @@ Generators Extended
scripted_intro
script_mk2
smooth_lines
\ Нет новой строки в конце файла
ellipse
super_ellipsoid
docs/nodes/list_main/list_main_index.rst
Просмотр файла @
35956091
...
...
@@ -13,3 +13,4 @@ List Main
match
sum_mk2
zip
statistics
docs/nodes/list_mutators/list_mutators_index.rst
Просмотр файла @
35956091
...
...
@@ -6,3 +6,5 @@ List Mutators
:maxdepth: 2
modifier
polygon_sort
combinatorics
docs/nodes/logic/logic_index.rst
Просмотр файла @
35956091
...
...
@@ -8,3 +8,4 @@ Logic
logic_node
neuro_elman
switch
input_switch
docs/nodes/matrix/matrix_index.rst
Просмотр файла @
35956091
...
...
@@ -16,3 +16,4 @@ Matrix
matrix_track_to
shear
matrix_normal
iterate
docs/nodes/modifier_change/modifier_change_index.rst
Просмотр файла @
35956091
...
...
@@ -15,16 +15,12 @@ Modifier Change
extrude_separate
extrude_region
holes_fill
iterate
mesh_join
mesh_separate
objects_along_edge
bend_along_path
bend_along_surface
offset
polygons_boom
polygons_to_edges
randomize
recalc_normals
remove_doubles
triangulate
...
...
docs/nodes/modifier_make/modifier_make_index.rst
Просмотр файла @
35956091
...
...
@@ -19,3 +19,7 @@ Modifier Make
voronoi_2d
wafel
wireframe
offset_line
bevel_curve
contour2D
fractal_curve
docs/nodes/number/number_index.rst
Просмотр файла @
35956091
...
...
@@ -10,10 +10,12 @@ Number
float
float_to_int
formula2
formula3
integer
list_input
mix_numbers
random
random_num_gen
range_float
range_int
range_map
...
...
docs/nodes/text/text_index.rst
Просмотр файла @
35956091
...
...
@@ -13,4 +13,4 @@ Text
shape
text_in_mk2
text_out
viewer_text_mk
2
viewer_text_mk
3
docs/nodes/vector/vector_index.rst
Просмотр файла @
35956091
...
...
@@ -25,3 +25,5 @@ Vector
vertices_sort
variable_lacunarity
turbulence
linear_approx
color_input
tests/docs_tests.py
0 → 100644
Просмотр файла @
35956091
from
os.path
import
basename
,
splitext
,
dirname
,
join
,
exists
from
os
import
walk
import
sverchok
from
sverchok.utils.testing
import
*
from
sverchok.utils.logging
import
debug
,
info
,
error
class
DocumentationTests
(
SverchokTestCase
):
def
test_all_node_docs_in_trees
(
self
):
"""
Check that each node documentation file is mentioned in corresponding index file.
"""
def
check
(
index_file_path
,
doc_file_path
):
(
name
,
ext
)
=
splitext
(
basename
(
doc_file_path
))
found
=
False
with
open
(
index_file_path
,
'r'
)
as
index
:
for
line
in
index
:
line
=
line
.
strip
()
if
line
==
name
:
found
=
True
break
return
found
def
check_dir
(
directory
,
fnames
):
dir_name
=
basename
(
directory
)
index_name
=
dir_name
+
"_index.rst"
index_file_path
=
join
(
directory
,
index_name
)
bad_files
=
[]
for
fname
in
fnames
:
if
fname
.
endswith
(
"_index.rst"
):
continue
if
not
check
(
index_file_path
,
fname
):
bad_files
.
append
(
fname
)
if
bad_files
:
error
(
"The following files are not mentioned in %s:
\n
%s"
,
index_name
,
"
\n
"
.
join
(
bad_files
))
self
.
fail
(
"Not all node documentation files are mentioned in their corresponding indexes."
)
sv_init
=
sverchok
.
__file__
docs_dir
=
join
(
dirname
(
sv_init
),
"docs"
,
"nodes"
)
for
directory
,
subdirs
,
fnames
in
walk
(
docs_dir
):
with
self
.
subTest
(
directory
=
basename
(
directory
)):
check_dir
(
directory
,
fnames
)
def
test_node_docs_refs_from_trees
(
self
):
def
check_dir
(
directory
):
dir_name
=
basename
(
directory
)
index_name
=
dir_name
+
"_index.rst"
index_file_path
=
join
(
directory
,
index_name
)
bad_files
=
[]
if
exists
(
index_file_path
):
with
open
(
index_file_path
,
'r'
)
as
index
:
start
=
False
for
line
in
index
:
line
=
line
.
strip
()
if
not
line
:
continue
if
":maxdepth:"
in
line
:
start
=
True
continue
if
not
start
:
continue
doc_name
=
line
+
".rst"
doc_path
=
join
(
directory
,
doc_name
)
if
not
exists
(
doc_path
):
bad_files
.
append
(
doc_name
)
if
bad_files
:
error
(
"The following files, which are referenced from %s, do not exist:
\n
%s"
,
index_name
,
"
\n
"
.
join
(
bad_files
))
self
.
fail
(
"Not all node documentation referenced from index files exist."
)
sv_init
=
sverchok
.
__file__
docs_dir
=
join
(
dirname
(
sv_init
),
"docs"
,
"nodes"
)
for
directory
,
subdirs
,
fnames
in
walk
(
docs_dir
):
with
self
.
subTest
(
directory
=
basename
(
directory
)):
check_dir
(
directory
)
utils/testing.py
Просмотр файла @
35956091
...
...
@@ -160,18 +160,21 @@ def get_tests_path():
tests_dir
=
join
(
dirname
(
sv_init
),
"tests"
)
return
tests_dir
def
run_all_tests
():
def
run_all_tests
(
pattern
=
None
):
"""
Run all existing test cases.
Test cases are looked up under tests/ directory.
"""
if
pattern
is
None
:
pattern
=
"*_tests.py"
tests_path
=
get_tests_path
()
log_handler
=
logging
.
FileHandler
(
join
(
tests_path
,
"sverchok_tests.log"
),
mode
=
'w'
)
logging
.
getLogger
().
addHandler
(
log_handler
)
try
:
loader
=
unittest
.
TestLoader
()
suite
=
loader
.
discover
(
start_dir
=
tests_path
,
pattern
=
"*_tests.py"
)
suite
=
loader
.
discover
(
start_dir
=
tests_path
,
pattern
=
pattern
)
buffer
=
StringIO
()
runner
=
unittest
.
TextTestRunner
(
stream
=
buffer
,
verbosity
=
2
)
result
=
runner
.
run
(
suite
)
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать