Skip to content

Commit

Permalink
Merge pull request #85 from Erotemic/dev/0.15.0
Browse files Browse the repository at this point in the history
Dev/0.15.0
  • Loading branch information
Erotemic committed Sep 11, 2020
2 parents b76aa9c + 3601251 commit 9e0bfb4
Show file tree
Hide file tree
Showing 25 changed files with 1,370 additions and 311 deletions.
102 changes: 81 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
# ### INITIALIZE AND CACHE REQUIREMENTS ###
- restore_cache:
keys:
- v2-dependencies-{{ checksum "requirements/runtime.txt" }}-{{ checksum "requirements/tests.txt" }}
- v3-dependencies-{{ checksum "requirements/runtime.txt" }}-{{ checksum "requirements/tests.txt" }}-{{ checksum "requirements/jupyter.txt" }}
- run:
name: install dependencies
command: |
Expand All @@ -63,14 +63,15 @@ jobs:
- save_cache:
paths:
- ./venv
key: v2-dependencies-{{ checksum "requirements/runtime.txt" }}-{{ checksum "requirements/tests.txt" }}
key: v3-dependencies-{{ checksum "requirements/runtime.txt" }}-{{ checksum "requirements/tests.txt" }}-{{ checksum "requirements/jupyter.txt" }}
# ### RUN TESTS ###
- run:
name: run tests
command: |
. venv/bin/activate
pip install pytest-cov==2.8.1 # hack to avoid regression
python run_tests.py
# pip install pytest-cov==2.8.1 # hack to avoid regression
#python run_tests.py
python -m pytest --cov=xdoctest --cov-config .coveragerc --cov-report term -s
- store_artifacts:
path: test-reports
destination: test-reports
Expand All @@ -86,7 +87,7 @@ jobs:
# ### INITIALIZE AND CACHE REQUIREMENTS ###
- restore_cache:
keys:
- v2-dependencies-{{ checksum "requirements/runtime.txt" }}-{{ checksum "requirements/optional.txt" }}-{{ checksum "requirements/tests.txt" }}
- v3-dependencies-{{ checksum "requirements/runtime.txt" }}-{{ checksum "requirements/optional.txt" }}-{{ checksum "requirements/tests.txt" }}-{{ checksum "requirements/jupyter.txt" }}-{{ checksum "requirements/colors.txt" }}
- run:
name: install dependencies
command: |
Expand All @@ -100,14 +101,15 @@ jobs:
- save_cache:
paths:
- ./venv
key: v2-dependencies-{{ checksum "requirements/runtime.txt" }}-{{ checksum "requirements/optional.txt" }}-{{ checksum "requirements/tests.txt" }}
key: v3-dependencies-{{ checksum "requirements/runtime.txt" }}-{{ checksum "requirements/optional.txt" }}-{{ checksum "requirements/tests.txt" }}-{{ checksum "requirements/jupyter.txt" }}-{{ checksum "requirements/colors.txt" }}
# ### RUN TESTS ###
- run:
name: run tests
command: |
. venv/bin/activate
pip install pytest-cov==2.8.1 # hack to avoid regression
python run_tests.py
# pip install pytest-cov==2.8.1 # hack to avoid regression
#python run_tests.py
python -m pytest --cov=xdoctest --cov-config .coveragerc --cov-report term -s
- store_artifacts:
path: test-reports
destination: test-reports
Expand Down Expand Up @@ -227,25 +229,83 @@ jobs:
- PYTHON_EXE: pypy3
working_directory: ~/repo-full-pypy3

heredoc:
docker:
- image: pypy:3
working_directory: ~/dev-only-not-a-real-job
steps:
- |
__heredoc__="
.__heredoc__: &__heredoc__
- |
IMAGE_NAME=circleci/python:3.9
docker pull $IMAGE_NAME
IMAGE_NAME=pypy:3
docker pull $IMAGE_NAME
docker run -v $HOME/code/xdoctest:/io -it $IMAGE_NAME bash
IMAGE_NAME=circleci/python:3.10-rc
docker pull $IMAGE_NAME
docker run -v $HOME/code/xdoctest:/io -it pypy:3 bash
docker run -v $HOME/code/xdoctest:/io -it $IMAGE_NAME bash
cd /io
# Logic to print out the commands to reproduce CI steps
source $HOME/local/init/utils.sh
pyblock "
import yaml
import ubelt as ub
data = yaml.safe_load(open(ub.expandpath('$HOME/code/xdoctest/.circleci/config.yml')))
JOB_NAME = 'test-minimal-pypy3'
job = data['jobs'][JOB_NAME]
IMAGE_NAME = job['docker'][0]['image']
print('IMAGE_NAME={}'.format(IMAGE_NAME))
print('docker run -v $HOME/code/xdoctest:/io -it {} bash'.format(IMAGE_NAME))
print(ub.codeblock(
'''
###
###
# Clone the mounted repo for a fresh start
mkdir -p $HOME/code
git clone /io /root/{JOB_NAME}
cd /root/{JOB_NAME}
''').format(JOB_NAME=JOB_NAME))
for kv in job['environment']:
for k, v in kv.items():
print('{}={}'.format(k, v))
for step in job['steps']:
if 'run' in step:
print(step['run']['command'])
"
pypy3 -m venv venv
IMAGE_NAME=pypy:3
docker run -v /home/joncrall/code/xdoctest:/io -it pypy:3 bash
###
###
# Clone the mounted repo for a fresh start
mkdir -p /home/joncrall/code
git clone /io /root/test-minimal-pypy3
cd /root/test-minimal-pypy3
PYTHON_EXE=pypy3
$PYTHON_EXE -m venv venv || virtualenv -v venv # first command is python3 || second is python2
. venv/bin/activate
# The "minimal" tests install barebones requirements
pip install pip -U
pip install -r requirements/tests.txt
pip install -r requirements/runtime.txt
pip install -e .
pip install .
pip install pytest-cov==2.8.1 # hack to avoid regression
./run_doctests.sh || echo "pypy failed, but this is allowed"
./run_tests.sh || echo "pypy failed, but this is allowed"
"
. venv/bin/activate
python -m pytest --cov=xdoctest --cov-config .coveragerc --cov-report term -s
# pip install pytest-cov==2.8.1 # hack to avoid regression
#python run_tests.py
# TO RUN A JOB ON YOUR LOCAL MACHINE
# INSTALL CIRCLE CI
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | DESTDIR=$HOME/.local/bin bash
JOB_NAME=test-minimal-pypy3
circleci local execute --job $JOB_NAME
JOB_NAME=test-full-pypy3
circleci local execute --job $JOB_NAME
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ python:
- "3.4"
- "3.5"
- "3.6"
- "nightly"
#- "nightly" # remove nightly for now

before_install:
- pip install pip -U
Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,31 @@ We are currently working on porting this changelog to the specifications in
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Version 0.14.0] - Uneleased
## Version 0.15.0 - Unreleased


### Added
* `pip install xdoctest` can now specify `[colors]` or `[jupyter]`
* Enhanced REQUIRES directive behavior, multiple comma-separated requirements
can now be listed in one directive.
* Xdoctest can now be run inside of Jupyter notebooks / IPython sessions
* Xdoctest can now be run on Jupyter notebooks (Note that in general it is
better practice to write a module)

### Fixed
* Bug in `doctest_callable` where it would not populate globals from the function context.

### Changed
* Renamed `Config` to `DoctestConfig`
* Renamed `static_analysis.parse_calldefs` to `static_analysis.parse_static_calldefs`.
A temporary function with the old name is exposed for backwards compatibility.
* Changed argument name from `modpath_or_name` to `module_identifier` in several functions.
This is to better indicate its coercible nature as either a module path, a
module name. This change impacts `doctest_module`, `parse_doctestables`,
`package_calldefs`.


## [Version 0.14.0] - Released 2020-08-26

### Added
* The REQUIRES directive can now inspect existence or values of environment variables.
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test_script:
- set PYTHONIOENCODING=utf-8
- "%PYTHON%\\python.exe -m pip install pytest-cov==2.8.1"
- "%PYTHON%\\python.exe -m xdoctest xdoctest"
- "%PYTHON%\\python.exe -m pytest"
- "%PYTHON%\\python.exe -m pytest -s --xdoctest-verbose=3"

after_test:
# This step builds your wheels.
Expand All @@ -77,7 +77,7 @@ after_test:

artifacts:
# bdist_wheel puts your built wheel in the dist directory
- path: dist\*
#- path: dist\*

#on_success:
# You can use this step to upload your artifacts to a public website.
Expand Down
4 changes: 2 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[pytest]
# ON COVERAGE OF PYTEST PLUGINS:
# http://pytest-cov.readthedocs.io/en/latest/plugins.html
addopts = -p pytester -p no:doctest --xdoctest --ignore-glob=setup.py
addopts = -p pytester -p no:doctest --xdoctest --ignore-glob=setup.py --ignore=.tox
norecursedirs = .git ignore build __pycache__ docs *.egg-info _* dev testing/pybind11_test setup.py
--pyargs --doctest-modules --ignore=.tox
# --pyargs --doctest-modules --ignore=.tox
;rsyncdirs = tox.ini pytest.py _pytest testing
;python_files = test_*.py *_test.py testing/*/*.py
;python_classes = Test Acceptance
Expand Down
2 changes: 2 additions & 0 deletions requirements/colors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Pygments >= 2.2.0
colorama >= 0.4.1;platform_system=="Windows"
6 changes: 6 additions & 0 deletions requirements/jupyter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nbformat;python_version>'3.4'
nbconvert; python_version>'3.4'
jupyter_client; python_version>'3.4'
IPython; python_version>'3.4'
ipykernel; python_version>'3.4'

4 changes: 2 additions & 2 deletions requirements/optional.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Pygments >= 2.2.0
colorama >= 0.4.1;platform_system=="Windows"
-r colors.txt
-r jupyter.txt
9 changes: 9 additions & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
pytest >= 3.3.1
pytest-cov
codecov >= 2.0.15

# For testing doctests in binary extension modules
scikit-build
cmake
ninja
pybind11

# for testing doctests in jupyter notebooks
-r jupyter.txt

#pip uninstall pytest-ipynb
#pytest-ipynb >= 1.1.1
#pip install pytest-notebook
Loading

0 comments on commit 9e0bfb4

Please sign in to comment.