Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit 51c2cfb

Browse files
Keith RobertsKeith Roberts
Keith Roberts
and
Keith Roberts
authored
exdown -> pytest-codeblocks (#213)
* exdown -> pytest-codeblocks * updates for new black linter Co-authored-by: Keith Roberts <krober@usp.edu>
1 parent e0dae18 commit 51c2cfb

File tree

7 files changed

+34
-41
lines changed

7 files changed

+34
-41
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ size.**
201201

202202
![Above shows the mesh in ParaView that results from running the code below.](https://user-images.githubusercontent.com/18619644/103445790-52cd8b00-4c57-11eb-8bd4-4af8f24d4c88.jpg)
203203

204-
<!--exdown-skip-->
204+
<!--pytest-codeblocks:skip-->
205205
```python
206206
from mpi4py import MPI
207207
import zipfile
@@ -819,13 +819,16 @@ Changelog
819819

820820
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
821821
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
822-
## Unreleased
822+
## Unrelease
823+
- None
824+
## [3.6.1]-2021-05-22
823825
### Added
824826
- Smoothed sets (e.g., intersections, differences, and unions)
825827
- Conversion of velocity data from feet-second to meters-second
826828
- Support for fixed points in iterative Laplacian mesh smoother.
827829
### Improved
828830
- Simplified pybind11 build system.
831+
- Now using pytest-codeblocks instead of exdown
829832

830833
## [3.5.0]-2021-03-09
831834
### Added

SeismicMesh/generation/mesh_generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ def _select_cgal_dim(dim):
899899

900900

901901
def _get_topology(dt):
902-
""" Get points and entities from :clas:`CGAL:DelaunayTriangulation2/3` object"""
902+
"""Get points and entities from :clas:`CGAL:DelaunayTriangulation2/3` object"""
903903
p = dt.get_finite_vertices()
904904
t = dt.get_finite_cells()
905905
return p, t

SeismicMesh/migration/migration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def localize_sizing_function(fh, h0, bbox, dim, axis, comm):
5353

5454

5555
def localize_points(blocks, extents, comm, dim):
56-
""" Distribute points to local subdomains """
56+
"""Distribute points to local subdomains"""
5757
rank = comm.Get_rank()
5858
size = comm.Get_size()
5959
for local in range(1, size):

SeismicMesh/sizing/mesh_size_function.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def _enforce_courant_sizing(vp, cell_size, cr_max, dt, space_order):
435435

436436

437437
def _enforce_gradation_sizing(cell_size, grade, elen):
438-
"""Call-back to the cpp gradient limiter code """
438+
"""Call-back to the cpp gradient limiter code"""
439439
if grade == 0.0:
440440
warnings.warn(
441441
"Mesh size gradient is deactiavted. This may compromise mesh quality"

setup.cfg

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = SeismicMesh
3-
version = 3.6.0
3+
version = 3.6.1
44
url = https://github.com/krober10nd/SeismicMesh
55
author = Keith Roberts
66
email = keithrbt0@gmail.com
@@ -36,6 +36,7 @@ install_requires =
3636
mpi4py
3737
pybind11 >= 2.6
3838
pyamg == 4.0.0
39+
pytest_codeblocks
3940
python_requires = >=3.0
4041

4142
[options.extras_require]

tests/test_README.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1+
import os
12
import gzip
23
import pathlib
34
import shutil
45

5-
import exdown
66
import pytest
77
import requests
88

99
this_dir = pathlib.Path(__file__).resolve().parent
1010

1111

1212
@pytest.mark.serial
13-
@pytest.mark.parametrize(
14-
"string,lineno",
15-
exdown.extract(
16-
this_dir.parent / "README.md", syntax_filter="python", max_num_lines=100000
17-
),
18-
)
19-
def test_readme(string, lineno):
13+
def test_readme():
2014

2115
# download
2216
url = "http://s3.amazonaws.com/open.source.geoscience/open_data/bpvelanal2004/vel_z6.25m_x12.5m_exact.segy.gz"
@@ -31,9 +25,4 @@ def test_readme(string, lineno):
3125
) as f_out:
3226
shutil.copyfileobj(f_in, f_out)
3327

34-
try:
35-
# https://stackoverflow.com/a/62851176/353337
36-
exec(string, {"__MODULE__": "__main__"})
37-
except Exception:
38-
print(f"README.md (line {lineno}):\n```\n{string}```")
39-
raise
28+
os.system(f"pytest --codeblocks {this_dir.parent}/README.md")

tox.ini

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
[tox]
2-
envlist = py36, py37, py38, py39
3-
isolated_build = True
4-
5-
[mpi]
6-
mpiexec = {env:MPIEXEC:mpiexec}
7-
8-
[testenv]
9-
setenv =
10-
MPLBACKEND = agg
11-
deps =
12-
exdown
13-
requests
14-
pytest
15-
pytest-cov
16-
mpi4py
17-
whitelist_externals = {[mpi]mpiexec}
18-
commands =
19-
{[mpi]mpiexec} -n 2 -mca btl ^openib pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 -m "parallel2"
20-
{[mpi]mpiexec} -n 2 -mca btl ^openib pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 --cov-append -m "parallel3"
21-
pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 --cov-append -m "serial"
1+
[tox]
2+
envlist = py36, py37, py38, py39
3+
isolated_build = True
4+
5+
[mpi]
6+
mpiexec = {env:MPIEXEC:mpiexec}
7+
8+
[testenv]
9+
setenv =
10+
MPLBACKEND = agg
11+
deps =
12+
pytest-codeblocks
13+
requests
14+
pytest
15+
pytest-cov
16+
mpi4py
17+
whitelist_externals = {[mpi]mpiexec}
18+
commands =
19+
{[mpi]mpiexec} -n 2 -mca btl ^openib pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 -m "parallel2"
20+
{[mpi]mpiexec} -n 2 -mca btl ^openib pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 --cov-append -m "parallel3"
21+
pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 --cov-append -m "serial"

0 commit comments

Comments
 (0)