Skip to main content

A nose plugin to detect tests making http calls.

Project description

A nose plugin that can detect tests making external http calls. Example output:

$ nosetests -v --with-detecthttp myapp/
test_that_makes_request ... ok
test_with_no_request ... ok

======================================================================
FAIL: Tests made external http calls
----------------------------------------------------------------------
- myapp.tests.AppTest:

    test_that_makes_request:
      GET http://example.com

----------------------------------------------------------------------
Ran 2 tests in 0.001s

FAILED (failures=1)

Sometimes, you want to ignore hosts besides localhost. For example, you might be running tests in a containerized environment where dynamodb has the hostname dynamodb and mysql has the hostname mysql. To ignore these hosts, the –vcr-ignore-host option:

nosetests -v --with-detecthttp --vcr-ignore-host=www.example.com,dynamodb,mysql app/
test_one (app.tests.ExternalTestCase) ... ok
test_two (app.tests.ExternalTestCase) ... ok

----------------------------------------------------------------------
Ran 2 tests in 0.042s

OK

Under the hood, this wraps every test in a separate VCR.py cassette. Since VCR.py’s hooks are in the stdlib, this approach won’t detect requests made with clients like PycURL.

History

1.0.0

released 2018-09-12

  • breaking: ignore host flag now accepts comma-separated values rather than being provided multiple times

0.2.0

released 2017-08-15

  • add –vcr-ignore-host option to ignore custom hosts

0.1.3

released 2015-10-16

  • python 3 support

0.1.1

released 2014-11-24

  • initial release

Project details


Download files

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

Source Distribution

nose-detecthttp-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file nose-detecthttp-1.0.0.tar.gz.

File metadata

  • Download URL: nose-detecthttp-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for nose-detecthttp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 05015a61d7a2ab739d5140d2e0e483cfd05cbb42a5b141a6af077dbd2cc8515d
MD5 cc3101ef0e39ff993bdd97b5303c7e4d
BLAKE2b-256 c6c00263090a320b20e97f3ff6c500e76f8e496b035515adf572f01b99d5ee09

See more details on using hashes here.

Supported by

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