Skip to content

Commit

Permalink
Merge pull request #86 from chmp/feature/prepare-release
Browse files Browse the repository at this point in the history
Feature/prepare release
  • Loading branch information
chmp authored Nov 5, 2022
2 parents 367631b + 74522d1 commit c66e1e7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 30 deletions.
58 changes: 35 additions & 23 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,41 @@

Note: development is tracked on the [`develop` branch](https://github.com/chmp/ipytest/tree/develop).

- `develop`:
- Migrated to `pyproject.toml`
- Fix the random module name during each notebook session to allow `--ff`
and similar options to work correctly.
- Rename `clean_tests` to `clean` and deprecate `clean_tests`.
- Add `defopts="auto"`, which only adds the current notebook to the PyTest
arguments, if no other node id that references the notebook is specified
- Add shorthands to generate node ids for tests using `{test_example}` as an
argument will expand to `{MODULE}::test_example`
- Allow to override `addopts`, `defopts`, `run_in_thread`, `raise_on_error`,
`display_columns` in `ipytest.run`
- Allow to specify all keyword arguments of `ipytest.run` also in
`%%ipytest` by including an initial comment of the form `# ipytest:
arg1=value1, arg2=value`
- `ipytest.clean()` now expects a module as its argument
- Add `ipytest.force_reload`. It is simpler to use than the current `reload`
function for reloading modules during development
- Use markdown for module documentation
- Updated documentation (updated doc strings for run, ipytest magic,
expanded example notebook)
- Fix bug for `--deselect {MODULE}::test`
- Disable variable expansion in magic to simplify using `{test}` shorthands
in notebooks
## `develop`

Usability improvements:

- Use the same random module name during a notebook session to allow `--ff` and
similar options to work correctly
- Allow to specify `defopts="auto"`. It only adds the current notebook to the
PyTest arguments, if no other node id that referencing the notebook is
specified. This way specifying node ids manually should work as expected
without any configuration change in most cases
- Add shorthands to generate node ids for tests using `{test_example}` as an
argument will expand to `{MODULE}::test_example`
- Allow to override `addopts`, `defopts`, `run_in_thread`, `raise_on_error`,
`display_columns` in `ipytest.run`
- Allow to specify all keyword arguments of `ipytest.run` also in `%%ipytest` by
including an initial comment of the form `# ipytest: arg1=value1, arg2=value`
- Rename `clean_tests` to `clean` and deprecate `clean_tests`. The optional
scope argument now expects a module instead of a dictionary
- Add `ipytest.force_reload`, as a simpler to use alternative to the current
`reload` function

Bug fixes:

- Fix bug for `--deselect {MODULE}::test`
- Disable variable expansion in magics to prevent issues with the `{node_id}`
shorthands in notebooks

Development changes:

- Use markdown for module documentation and doc strings
- Migrated to `pyproject.toml`
- Updated documentation

## Previous versions

- `0.12.0`:
- Re-add the `raise_on_error` config option
- Return the `exit_code` from `ipyest.run()`
Expand Down
15 changes: 8 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ There are multiple sources of global state when using pytest inside the notebook
function allows to delete previously defined tests.
2. Python's module system caches imports and therefore acts as a global state.
To test the most recent version of any module, the module needs to be
reloaded. `ipytest` offers the [`ipytest.reload()`][ipytest.reload] function.
The `autoreload` extension of IPython may also help here. To test local
packages, it is advisable to install them as development packages, e.g., `pip
install -e .`.
reloaded. `ipytest` offers the
[`ipytest.force_reload()`][ipytest.force_reload] function. The `autoreload`
extension of IPython may also help here. To test local packages, it is
advisable to install them as development packages, e.g., `pip install -e .`.
3. For async code, IPython will create an event loop in the current thread. This
setup may interfere with async tests. To support these use cases, ipytest
supports running tests in a separate thread. Simply setup ipytest via
Expand Down Expand Up @@ -109,8 +109,8 @@ ways to configure this behavior:
- `ipytest.config(defopts=False)` or `ipytest.autoconfig(defopts=False)` will
instruct `ipytest` to not pass the current module filename. It can still be
passed manually by adding `{MODULE}` to the command line. The default value
`defopts="auto"`, adds `{MODULE}` if no other PyTest node id is found in the
arguments
`defopts="auto"`, adds `{MODULE}` if no other PyTest node id is found among
the arguments

The arguments are formatted using Python's standard string formatting.
Currently, only the `{MODULE}` variable is understood. It is replaced with the
Expand Down Expand Up @@ -141,7 +141,7 @@ following steps:
| [`exit_code`][ipytest.exit_code]
| [`run`][ipytest.run]
| [`clean`][ipytest.clean]
| [`reload`][ipytest.reload]
| [`force_reload`][ipytest.force_reload]
| [`Error`][ipytest.Error]

<!-- minidoc "function": "ipytest.autoconfig", "header_depth": 3 -->
Expand Down Expand Up @@ -323,6 +323,7 @@ Usage:

```python
ipytest.force_reload("my_package")
from my_package.submodule import my_function
```

<!-- minidoc -->
Expand Down
1 change: 1 addition & 0 deletions ipytest/_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def force_reload(*include: str, modules: Optional[Dict[str, ModuleType]] = None)
```python
ipytest.force_reload("my_package")
from my_package.submodule import my_function
```
"""
if modules is None:
Expand Down

0 comments on commit c66e1e7

Please sign in to comment.