Skip to main content

Tools to attach spy functions to functions and replace object references with new references

Project description

pyjack is a small debug / test module that allows you to:

  • Connect a ‘spy’ function to almost any python function. This spy function is called instead of the original function. The original function is passed to the spy function along with all args, kwargs so you can call the original function; modify the args, kwargs first, print a debug message, then call it; not call the function, just log it or print a debug message; etc. etc.

  • Provides a convenience function pyjack.replace_all_refs which uses the gc module to replace all references to an object with references to another object.

A quick example:

>>> import pyjack
>>>
>>> def fakeimport(orgopen, *args, **kwargs):
...
...     print 'Trying to import %s' % args[0]
...
...     return 'MODULE_%s' % args[0]
...
>>>
>>>
>>> pyjack.connect(__import__, spyfn=fakeimport)
<..._PyjackFuncBuiltin object at 0x...>
>>>
>>>
>>> import time
Trying to import time
>>>
>>>
>>> print time
MODULE_time
>>>
>>>
>>> __import__.restore()
>>>
>>> import time
>>> print time
<module 'time' (built-in)>

For full documentation and several examples please visit http://packages.python.org/pyjack/.

The git repo is here: https://github.com/cart0113/pyjack

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

pyjack-0.3.0.zip (6.7 kB view details)

Uploaded Source

pyjack-0.3.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyjack-0.3.0.win-amd64-py2.7.exe (230.1 kB view details)

Uploaded Source

pyjack-0.3.0.win-amd64-py2.6.exe (230.1 kB view details)

Uploaded Source

pyjack-0.3.0.win32-py2.7.exe (202.4 kB view details)

Uploaded Source

pyjack-0.3.0.win32-py2.6.exe (72.3 kB view details)

Uploaded Source

pyjack-0.3.0.win32-py2.5.exe (67.7 kB view details)

Uploaded Source

pyjack-0.3.0.win32-py2.4.exe (67.7 kB view details)

Uploaded Source

pyjack-0.3.0-py2.7.egg (7.1 kB view details)

Uploaded Egg

pyjack-0.3.0-py2.6.egg (7.1 kB view details)

Uploaded Egg

pyjack-0.3.0-py2.5.egg (7.1 kB view details)

Uploaded Egg

pyjack-0.3.0-py2.4.egg (7.2 kB view details)

Uploaded Egg

File details

Details for the file pyjack-0.3.0.zip.

File metadata

  • Download URL: pyjack-0.3.0.zip
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyjack-0.3.0.zip
Algorithm Hash digest
SHA256 40afcbd5d02ee861d1d1533db6e74a67d758f3f0fe693d5a509d8fa821e1fa13
MD5 aba6129d164f497ae91570d3c3b7bc4b
BLAKE2b-256 cd78bc784cb7b134d264b66973565dfc03701bc083404e011b6584e295de05ba

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0.tar.gz.

File metadata

  • Download URL: pyjack-0.3.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyjack-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7286dae52193c393fc3bc654b008fa3cdd38be71e717cf1a1bc47e9b7eb50938
MD5 7abe2915494b288a80174948af83410d
BLAKE2b-256 d66ad609f9108b520245e6c3c5cf16e226eb1d786b7ffa776f8788833bbc4717

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0.win-amd64-py2.7.exe.

File metadata

File hashes

Hashes for pyjack-0.3.0.win-amd64-py2.7.exe
Algorithm Hash digest
SHA256 e9b8ed69ae9a5f7440400b6948b4b78cecb5fd22021a473d08c7191186f0670a
MD5 37569f44461fdaaa6b018a6ac3dcc62b
BLAKE2b-256 789cde06859131ef44d27a2117bfa6b5e01f773f4844f54b75bc564a003ba189

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0.win-amd64-py2.6.exe.

File metadata

File hashes

Hashes for pyjack-0.3.0.win-amd64-py2.6.exe
Algorithm Hash digest
SHA256 2b11aee92fefc6626762eeb7137bb814514432e64461ceb8c36c756723607885
MD5 9bdb2d79f8098d403362da00c4afb04b
BLAKE2b-256 78f8bd8921a669cd361dbb470d1a0b430c95c55c2224540049a6b556994ab2b7

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0.win32-py2.7.exe.

File metadata

File hashes

Hashes for pyjack-0.3.0.win32-py2.7.exe
Algorithm Hash digest
SHA256 478e37e7965de6b1ac87851ce90cac12dc4e80d0c1efa62e080270d65571de59
MD5 69537d9bc76d45be089c0f4af1ee60c2
BLAKE2b-256 b907cd9b1fdaa920527114f4055adce689740f74c5fac590d9889216b666d8e5

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0.win32-py2.6.exe.

File metadata

File hashes

Hashes for pyjack-0.3.0.win32-py2.6.exe
Algorithm Hash digest
SHA256 ddc86583f3ba4c2799544e48727eed7132a0a32416fe0a8d2ed1277307c4823f
MD5 7c126192563536e91288a5c336514c42
BLAKE2b-256 87360455523e8041aba3a57223d92ff6741596c5c8859a2e0407d007c7e09ea1

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0.win32-py2.5.exe.

File metadata

File hashes

Hashes for pyjack-0.3.0.win32-py2.5.exe
Algorithm Hash digest
SHA256 e1ea071b8ae2c459ea033c7f3a3e4fbff0dc3fccc8c20c0efe5da297bcc1a507
MD5 babb0b49542ecf2fc626c848e6321041
BLAKE2b-256 0f52045c7875adb3c0697ce88bfd3e57911f40d58b2b4ee043ff6c2609569f6c

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0.win32-py2.4.exe.

File metadata

File hashes

Hashes for pyjack-0.3.0.win32-py2.4.exe
Algorithm Hash digest
SHA256 47e9fd42ac03bdaa20ae714540b3723064d4854438f4ee0f051789c55da8a1e0
MD5 a5000b62b508e99d15f59c3b141c5c44
BLAKE2b-256 f2fa269f954afbd7f1aaabc57c1c58d81381611109f6c659020747f994b9135c

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0-py2.7.egg.

File metadata

  • Download URL: pyjack-0.3.0-py2.7.egg
  • Upload date:
  • Size: 7.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyjack-0.3.0-py2.7.egg
Algorithm Hash digest
SHA256 804fb4fbf8089b165b7cbe57abaff5767a0dba0d190495ebdd0c44e7683b13bf
MD5 9dedb3ecd9267371fe44d5c4c408381a
BLAKE2b-256 953161daccfb6bce30e54a4f2aaad63bc691cc055bcc44200e04acb654eadfd5

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0-py2.6.egg.

File metadata

  • Download URL: pyjack-0.3.0-py2.6.egg
  • Upload date:
  • Size: 7.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyjack-0.3.0-py2.6.egg
Algorithm Hash digest
SHA256 b0bd1a8700aebee5d8ff57eb8af5ba2ed4abae138e225888005f01ce07587594
MD5 1839875111f4f75a425383dcb536ec58
BLAKE2b-256 ee8f582caf7d5dccf9f25b928a5645d0ce87433f625e56e490bf6c2508258f56

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0-py2.5.egg.

File metadata

  • Download URL: pyjack-0.3.0-py2.5.egg
  • Upload date:
  • Size: 7.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyjack-0.3.0-py2.5.egg
Algorithm Hash digest
SHA256 9af5a5bb3ad0f119c48bacea5199e6f6ee2aa9fa3657265b522e00446bc79d47
MD5 c2b7b3dcfe291827ef891300cf22b00d
BLAKE2b-256 e2eda7da585733b5591f9ab8c6a17ec53f1dc9bbdd48cc2d48e79c745589595c

See more details on using hashes here.

File details

Details for the file pyjack-0.3.0-py2.4.egg.

File metadata

  • Download URL: pyjack-0.3.0-py2.4.egg
  • Upload date:
  • Size: 7.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyjack-0.3.0-py2.4.egg
Algorithm Hash digest
SHA256 e3d935e2406f17287822b2678c867dfcb47b1fdeef2c51fd0e8cae180475a8c5
MD5 cfe9d4d6239fd3143e25ccf8071849d0
BLAKE2b-256 73cd1bd1cb35e51d19d5524c1b39f3b89e9f484d8b35ce3a0f687f6e1fe1e843

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page