decoy

🦆 Opinionated mocking library for Python

MIT License

Downloads
10.6K
Stars
25
Committers
4

Bot releases are hidden (Show)

decoy - v2.1.1 Latest Release

Published by mcous 11 months ago

Maintenance release to note official support for Python 3.12

decoy - v2.1.0

Published by mcous about 1 year ago

Features

  • spy: warn if mock used with a missing attribute (#218) (72cefe4), closes #204
decoy - v2.0.2

Published by mcous over 1 year ago

Bug Fixes

  • spy: ensure __eq__ of rehearsal arg is preferred (#201) (63413d8)
decoy - v2.0.1

Published by mcous over 1 year ago

Bug Fixes

  • warnings: trigger reset warnings at a better stack level (#165) (56863f5)
decoy - v2.0.0

Published by mcous over 1 year ago

Refactors

  • require mock name, remove deprecated methods, drop Python 3.6 (#151) (1f4e9b3)

BREAKING CHANGES

  • if you do not specify a cls or func argument to decoy.mock(),
    you must specify a name parameter.

You can use the following find-and-replace patterns
to fix most tests that start failing due to this change:

# find
([a-z_]+?)(: .+?)? = decoy.mock\(\)
# replace
$1$2 = decoy.mock(name="$1")
# find
([a-z_]+?)(: .+?)? = decoy.mock\(is_async=(.+?)\)
# replace
$1$2 = decoy.mock(name="$1", is_async=$3)
decoy - v1.11.3

Published by mcous almost 2 years ago

Bug Fixes

  • spy: prefix internal properties with _decoy (#150) (6a6868a), closes #144
decoy - v1.11.2

Published by mcous almost 2 years ago

Bug Fixes

  • spy: use classmethod __func__ source for async detection (#148) (0dfc38c), closes #146
decoy - v1.11.1

Published by mcous about 2 years ago

Bug Fixes

  • spy: resolve source to origin of GenericAlias (#143) (7d021c2), closes #142
decoy - v1.11.0

Published by mcous over 2 years ago

Bug Fixes

Features

  • when: allow then_do to take an async function (4ae00e5), closes #136
decoy - v1.10.3

Published by mcous over 2 years ago

Bug Fixes

  • spy: follow __wrapped__ when getting specs and signatures (#134) (8d86195), closes #133
decoy - v1.10.2

Published by mcous over 2 years ago

Bug Fixes

  • spy: handle properties that return primitive types (#132) (6eebc5a)
  • warnings: point to correct docs link in RedundantVerifyWarning (488eeec)
decoy - v1.10.1

Published by mcous over 2 years ago

Bug Fixes

  • warnings: do not trigger MiscalledStubWarnings from prop events (#126) (396eae2), closes #125
  • when: fix type overloads of then_enter_with on mypy v0.941 (#124) (5db349b)
decoy - v1.10.0

Published by mcous over 2 years ago

Bug Fixes

  • spy: ensure class signature uses __call__ (#120) (6a73b14)

Features

decoy - v1.9.0

Published by mcous almost 3 years ago

Features

  • when: add ContextManager mocking support (#93) (22bf2fb)
decoy - v1.8.0

Published by mcous almost 3 years ago

Bug Fixes

  • matchers: use isinstance() for matchers.IsA rather than type() (#88) (be6c780)
  • fix name argument type anotation in Decoy.mock (1a59098)
  • matchers: ensure ErrorMatching return type matches spec (#86) (c60af56)

Features

  • allow spec-less mocks to be named (#85) (dbc4813), closes #79
  • match args leniently according to spec signature (#89) (fbbe941), closes #78
decoy - v1.7.0

Published by mcous about 3 years ago

Bug Fixes

  • verify: improve verify traceback and error messages (#66) (9e74b36)

Features

  • allow extra arguments to be ignored (#61) (d1ba0d3), closes #60
decoy - v1.6.7

Published by mcous about 3 years ago

Bug Fixes

  • verify: ensure verify with times respects rehearsal args (#57) (af39c43)
decoy - v1.6.6

Published by mcous about 3 years ago

Bug Fixes

  • call_stack: match spy IDs in get_by_rehearsals (#55) (8845b5b), closes #54
decoy - v1.6.5

Published by mcous about 3 years ago

Bug Fixes

  • spy: match inspect.signature for staticmethods (#51) (f5dc60d)
decoy - v1.6.4

Published by mcous about 3 years ago

Bug Fixes

  • spy: gracefully degrade when a class's type hints can't be resolved at runtime (#47) (81072ed), closes #46