Commit Graph

11 Commits

Author SHA1 Message Date
Joshua Bronson ea9245bbe1 Fix readthedocs build to work with uv 2024-10-05 09:57:26 -04:00
Joshua Bronson 6a42b35683 update dev deps, use uv's new universal lockfile support, add python38 back to nix dev shell and tox matrix 2024-06-27 13:32:49 -04:00
Joshua Bronson 678c007d39
bugfix + rewrite tests + misc. improvements (#295)
- Fix `bidict(None)` bug (should raise TypeError).

- Simplify hypothesis tests, especially by using stateful testing.

- Add overriding type hints for `inv` for each bidict type
  (not just for `inverse`).

- Improve docs and fix readthedocs build as of move to python3.12 for
  building docs.
2024-01-08 20:56:05 -05:00
Joshua Bronson d9ccaa7918 Upgrade dev dependencies, drop support for Python 3.7.
Python 3.7 reached end of life on 2023-06-27 and is no longer supported
by all of bidict's development dependencies (e.g. hypothesis).
No longer advertise support for 3.7 in the project metadata, and remove
3.7 from the tox test matrix and in CI.

Also switch to using separate requirements files per Python version,
which allows pinning to dependencies' hashes.

Finally, don't bother adding dynamic optional-dependencies to
pyproject.toml, it's causing problems with lockfiles that use hashes.
2023-07-05 20:16:40 -04:00
Joshua Bronson 6c27412ad9 Go back to pytest-sphinx, use pytest-clarity, update deps
* Use pytest-sphinx to have pytest run doctests in Sphinx docs rather
  than using Sphinx to run these via run_tests.py.

  * Sphinx is no longer a test dependency, which allows upgrading to
    Sphinx 6.0 while still being able to run the tests with Python 3.7.
    (Sphinx 6.0 dropped support for 3.7.)

  * Use conftest.py rather than testsetup or doctest_global_setup, which
    pytest-sphinx does not currently support.

  * Don't use :skipif: in doctest:: directives since pytest-sphinx does
    not currently support it (thisch/pytest-sphinx#9). Instead just
    don't ever run the one doctest that was using this, since the
    behavior it was testing is also covered by several tests in
    test_properties.py that do still properly get run conditionally
    (specifically, the "freed on zero refcount" tests are still run on
    CPython but not PyPy).

  * Don't use >>> for code we don't want to test, since pytest-sphinx
    will otherwise still run it even if it's in a code-block directive
    (and sprinkling `# doctest: SKIP` everywhere as an alternative is
    noisy).

* Add pytest-clarity to dev dependencies and pass -vv to pytest by
  default to enable pytest-clarity's nicer diffs in development.
2023-01-04 00:52:12 -05:00
Joshua Bronson 55204e7b5f Upgrade dev dependencies. 2022-12-04 21:19:19 -05:00
Joshua Bronson 0a05f69ed1 Various minor improvements
- Simplify bidict._iter.iteritems
- Treat warnings as errors for Sphinx builds
- Improve learning-from-bidict docs
2022-02-14 18:34:20 -05:00
Joshua Bronson 214cd996fc Add sphinx-copybutton, fix readthedocs setup 2021-11-04 17:34:58 -04:00
Joshua Bronson bd4e652ae4 master -> main 2021-03-29 14:05:22 -04:00
jab daa6efc5bf Update to readthedocs config v2 2019-10-20 22:19:22 -04:00
jab 1a8e11f163 strengthen too-weak assume(..) in test_eq_ne_hash, use "max_examples=5000" for nightly CI jobs, add .readthedocs.yml
The `assume(init_items != init_unequal)` was not sufficient
because it would allow cases like:

    bi_cls=bidict, other_cls=bidict, init_items=[(1, 0), (0, 1)], init_unequal=[(0, 1), (1, 0)]

causing the resulting bidicts' item sets to still be equal,
so assertions like

    assert items_match(some_bidict, other_unequal, relation=ne)

would fail.

Changing the assume to

    assume(set(init_items) != set(init_unequal))

fixes the issue.

Surprisingly, hypothesis only just found a failing example for this
for the first time (in https://travis-ci.org/jab/bidict/jobs/363962257)
despite having numerous opportunities to find it before.
Using a new max_examples=5000 hypothesis profile, only on nightly CI,
should help surface any remaining issues that hypothesis hasn't found yet,
without slowing commit-triggered tests with too much example generation.

Also improve Travis config:
- ditch ALLOW_FAIL=1, for some reason it didn't work
- comment out python 3.7-dev job while Travis is stuck on an old 3.7 alpha
- don't use "- |" command block where we want to see output after each command
- prefix more network-dependent commands with travis_retry

Finally, improve docs building setup:
- Factor out sphinx from "dev" extras_require to its own "docs" extras_require.
- Add a .readthedocs.yml to customize the readthedocs build.
  Use pip and the "docs" extras_require to get an up-to-date Sphinx version.
  Fixes some broken :ref:`addendum:...`  autosectionlabel links in learning-from-bidict.
2018-04-10 11:31:29 +07:00