semvec/pypi-packages huggingface dataset:
pytest-modified-env 0.1.0
Pytest plugin to fail a test if it leaves modified `os.environ` afterwards.
License: MIT
Requires Python: >=3.7,<4.0
Keywords: pytest,pytest-plugin,os.environ,testing,unittest,tests,test,unit tests,code quality

# pytest-modified-env

[![Build Status](https://github.com/wemake-services/pytest-modified-env/workflows/test/badge.svg?branch=master&event=push)](https://github.com/wemake-services/pytest-modified-env/actions?query=workflow%3Atest)
[![Python Version](https://img.shields.io/pypi/pyversions/pytest-modified-env.svg)](https://pypi.org/project/pytest-modified-env/)
[![wemake-python-styleguide](https://img.shields.io/badge/style-wemake-000000.svg)](https://github.com/wemake-services/wemake-python-styleguide)

Pytest plugin to fail a test if it leaves modified `os.environ` afterwards.

Example:

```python
import os

def test_that_modifies_env() -> None:
    os.environ['CUSTOM_ENV'] = '1'
```

With `pytest-modified-env` plugin installed, this test will fail:

```
___________________________ test_that_modifies_env ____________________________
test_that_modifies_env:4: in pytest_runtest_call
E   RuntimeError: os.environ was changed
```

Because it adds `CUSTOM_ENV` inside a test and does not clean it up.
In theory it can affect other tests and tests should be isolated!


## Installation

```bash
pip install pytest-modified-env
```


## Extras

In some cases test still might modify the env in this way. 
But, it needs an explicit approval for that:

```python
import os
import pytest

@pytest.mark.modify_env()
def test_that_modifies_env() -> None:
    os.environ['CUSTOM_ENV'] = '1'
```

This test won't fail, eventhough it adds `CUSTOM_ENV`,
because it has `modifies_env` marker.


## License

[MIT](https://github.com/wemake-services/pytest-modified-env/blob/master/LICENSE)
scipybiteopt 1.2
Scipy style wrapper for Aleksey Vaneev's BiteOpt
License: MIT

# A python wrapper for biteopt #

This package provides a scipy.optimize like API for the powerful global optimization algorithm biteopt. It is a fork of [another biteopt wrapper](https://github.com/leonidk/biteopt). 

## Installation ##
```bash
pip install scipybiteopt
```
Note that the installation requires a C++ compiler.

## Example usage: optimizing the six-hump camel back function ##

```python
import scipybiteopt

def camel(x):
    """Six-hump camelback function"""
    x1 = x[0]
    x2 = x[1]
    f = (4 - 2.1*(x1*x1) + (x1*x1*x1*x1)/3.0)*(x1*x1) + x1*x2 + (-4 + 4*(x2*x2))*(x2*x2)
    return f

bounds = [(-4, 4), (-4, 4)]

res = scipybiteopt.biteopt(camel, bounds)
print("Found optimum: ", res.x)
```

## Biteopt version ##
The underlying biteopt version can be found via
```python
import scipybiteopt
scipybiteopt.__source_version__
```

## Citing ##
```bibtex
@misc{biteopt2021,
    author = {Aleksey Vaneev},
    title = {{BITEOPT - Derivative-free optimization method}},
    note = {C++ source code, with description and examples},
    year = {2021},
    publisher = {GitHub},
    journal = {GitHub repository},
    howpublished = {Available at \url{https://github.com/avaneev/biteopt}},
}
```