Skip to main content

Entry Point Testing

This module is designed to provide a strictly in-code implementation of MetaPathFinder that can be leveraged in unit testing in order to simulate an entry point being created, as would be loaded by importlib.metadata.entry_points() in Python 3.8+ or by importlib_metadata.entry_points() in earlier versions.

Requests for additional functionality aimed at testing plugin packages will be considered.

Usage

import unittest
import eptest


class Test(unittest.TestCase):

    def test_me(self):
        # Could move some of this to be a test fixture instead

        # Finder on sys.meta_path
        finder = eptest.TestFinder()

        # Add it to sys.meta_path
        finder.register()

        # Create a package
        package = eptest.TestPackage("foobar")

        # Create entry points
        package.add_entry_point(
            # Equivalent to a module with the following in setup.cfg:
            # [options.entry_points]
            # myep.group = 
            #     foobar = myep.tests:test.attr  
            eptest.TestEntryPoint("foobar", "myep.group", "myep.tests", "test.attr")
        )

        package.add_entry_point(
            # Equivalent to a module with the following in setup.cfg:
            # [options.entry_points]
            # myep.group = 
            #     foobar2 = myep.tests:test.attr[bar]  
            eptest.TestEntryPoint("foobar2", "myep.group", "myep.tests", "test.attr", ["bar"])
        )
        finder.add_package(package)

        # ... do tests

        # Call this to remove your foobar test package
        finder.remove_package(package)

        # Remove all packages
        finder.clear()

        # It is necessary to clean up sys.meta_path after your test case with this:
        finder.unregister()

Metadata

Release files for eptest 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eptest 0.1.1
File Size Uploaded Provenance Actions
eptest-0.1.1.tar.gz 3.8 kB Without provenance Details for eptest-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eptest 0.1.1
File Interpreter ABI Platform Actions
eptest-0.1.1-py3-none-any.whl Python 3 none any Details for eptest-0.1.1-py3-none-any.whl

Total release size: 8.2 kB

Release files / eptest-0.1.1.tar.gz

Download URL eptest-0.1.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3e705de418728295d176e3dc9fa0f2bac445f357467c6ac15f83da8b184c7a86
BLAKE2b-256 checksum
How to use checksums
29a5ad807d4a8451fedbdd056359b7930e5ab9012dede87b84c953d9e4310c09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.9

Release files / eptest-0.1.1-py3-none-any.whl

Download URL eptest-0.1.1-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
158dd9ae69f5ff7f02a03cd8256c98124bf9d173adb83e31776246c352b17518
BLAKE2b-256 checksum
How to use checksums
e7eb197060da627d13d071f01befa49cf5988136f7864f9672160e3ab7720ea1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.9

Security for eptest 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page