https://github.com/daskol/pytest-local

Simple forking server for testing with reusable context.

https://github.com/daskol/pytest-local

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary

Keywords

preloading pytest pytest-local testing
Last synced: 5 months ago · JSON representation

Repository

Simple forking server for testing with reusable context.

Basic Info
  • Host: GitHub
  • Owner: daskol
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 9.77 KB
Statistics
  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 3
Topics
preloading pytest pytest-local testing
Created almost 3 years ago · Last pushed almost 3 years ago
Metadata Files
Readme License

README.md

LTest

Simple forking server for testing with reusable context

Overview

ltest is extremeply simple forking server based on PyTest for local testing. The main goal of the project is to preload "fat" libraries like JAX or TensorFlow in execution context of PyTest. It is written from scratch with naked Python standard library and, of course, pytest.

It seems that it should be rewritten to use IPython kernel for better coherence with Jupyter since a lot of machine learning practitioners and researchers use it for development and testing. So, IPython could reduce possible unexpected side effects.

Usage Example

Here's an example usage of the ltest local PyTest server.

Suppose you have a project that uses JAX and you want to run your tests with PyTest. However, importing JAX takes a significant amount of time, which slows down your tests. To speed up your tests, you can use the PyTest testing server to preload JAX before running the tests.

First, create a Python script that defines your PyTest tests. Here's an example.

```python

simple_test.py

import jax, jax.numpy as jnp from numpy.testing import assertarrayequal

def testjitting(): def mul2(xs): return xs * 2 xs = jnp.ones(10) ys = jax.jit(mul2)(xs) assertarray_equal(2 * xs, ys) ```

Next, start the PyTest testing server.

shell ltest -l -m jax

This starts the testing server on the default interface 127.0.0.1 and port 7070 and preloads the jax package.

Finally, run your tests using the client.

shell ltest -- -s -v

This sends a request to the testing server to run the PyTest tests. The -s and -v options after -- are passted to PyTest and used to display output from the tests. The server responds with a JSON object that contains the exit code of the tests.

Command Line Interface (CLI)

Starting Server

shell ltest -l -m preloaded_pkg -m another.preloaded.pkg

Run Test on Local Server

shell ltest -- --co

Run Tests with Arguments on Local Server

shell ltest -- -v --tb=full -m slow -- path/to/suite/my_test.py

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 8
  • Total Committers: 1
  • Avg Commits per committer: 8.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Daniel Bershatsky d****y@g****m 8

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels