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

Commit

Permalink
exdown -> pytest-codeblocks (#213)
Browse files Browse the repository at this point in the history
* exdown -> pytest-codeblocks

* updates for new black linter

Co-authored-by: Keith Roberts <[email protected]>
  • Loading branch information
Keith Roberts and Keith Roberts authored May 25, 2021
1 parent e0dae18 commit 51c2cfb
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 41 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ size.**

![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)

<!--exdown-skip-->
<!--pytest-codeblocks:skip-->
```python
from mpi4py import MPI
import zipfile
Expand Down Expand Up @@ -819,13 +819,16 @@ Changelog

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

## [3.5.0]-2021-03-09
### Added
Expand Down
2 changes: 1 addition & 1 deletion SeismicMesh/generation/mesh_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ def _select_cgal_dim(dim):


def _get_topology(dt):
""" Get points and entities from :clas:`CGAL:DelaunayTriangulation2/3` object"""
"""Get points and entities from :clas:`CGAL:DelaunayTriangulation2/3` object"""
p = dt.get_finite_vertices()
t = dt.get_finite_cells()
return p, t
Expand Down
2 changes: 1 addition & 1 deletion SeismicMesh/migration/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def localize_sizing_function(fh, h0, bbox, dim, axis, comm):


def localize_points(blocks, extents, comm, dim):
""" Distribute points to local subdomains """
"""Distribute points to local subdomains"""
rank = comm.Get_rank()
size = comm.Get_size()
for local in range(1, size):
Expand Down
2 changes: 1 addition & 1 deletion SeismicMesh/sizing/mesh_size_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def _enforce_courant_sizing(vp, cell_size, cr_max, dt, space_order):


def _enforce_gradation_sizing(cell_size, grade, elen):
"""Call-back to the cpp gradient limiter code """
"""Call-back to the cpp gradient limiter code"""
if grade == 0.0:
warnings.warn(
"Mesh size gradient is deactiavted. This may compromise mesh quality"
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = SeismicMesh
version = 3.6.0
version = 3.6.1
url = https://github.com/krober10nd/SeismicMesh
author = Keith Roberts
email = [email protected]
Expand Down Expand Up @@ -36,6 +36,7 @@ install_requires =
mpi4py
pybind11 >= 2.6
pyamg == 4.0.0
pytest_codeblocks
python_requires = >=3.0

[options.extras_require]
Expand Down
17 changes: 3 additions & 14 deletions tests/test_README.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import os
import gzip
import pathlib
import shutil

import exdown
import pytest
import requests

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


@pytest.mark.serial
@pytest.mark.parametrize(
"string,lineno",
exdown.extract(
this_dir.parent / "README.md", syntax_filter="python", max_num_lines=100000
),
)
def test_readme(string, lineno):
def test_readme():

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

try:
# https://stackoverflow.com/a/62851176/353337
exec(string, {"__MODULE__": "__main__"})
except Exception:
print(f"README.md (line {lineno}):\n```\n{string}```")
raise
os.system(f"pytest --codeblocks {this_dir.parent}/README.md")
42 changes: 21 additions & 21 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[tox]
envlist = py36, py37, py38, py39
isolated_build = True

[mpi]
mpiexec = {env:MPIEXEC:mpiexec}

[testenv]
setenv =
MPLBACKEND = agg
deps =
exdown
requests
pytest
pytest-cov
mpi4py
whitelist_externals = {[mpi]mpiexec}
commands =
{[mpi]mpiexec} -n 2 -mca btl ^openib pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 -m "parallel2"
{[mpi]mpiexec} -n 2 -mca btl ^openib pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 --cov-append -m "parallel3"
pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 --cov-append -m "serial"
[tox]
envlist = py36, py37, py38, py39
isolated_build = True

[mpi]
mpiexec = {env:MPIEXEC:mpiexec}

[testenv]
setenv =
MPLBACKEND = agg
deps =
pytest-codeblocks
requests
pytest
pytest-cov
mpi4py
whitelist_externals = {[mpi]mpiexec}
commands =
{[mpi]mpiexec} -n 2 -mca btl ^openib pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 -m "parallel2"
{[mpi]mpiexec} -n 2 -mca btl ^openib pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 --cov-append -m "parallel3"
pytest --cov {envsitepackagesdir}/SeismicMesh --cov-report xml --cov-report term --ignore=pybind11 --cov-append -m "serial"

0 comments on commit 51c2cfb

Please sign in to comment.