what is addopts in pytest.ini
what is addopts in pytest.ini

In pytest.ini, `addopts` is used to specify command-line options that will be added to every pytest run. This is useful for setting up default options for all tests in your project.

For example, if you want to enable the `--tb=short` option for every test run to get a short traceback when a test fails, you can add the following line to your pytest.ini:

```
[pytest]
addopts = --tb=short
```

You can also specify multiple options by separating them with a space:

```
[pytest]
addopts = --tb=short --color=yes
```

This means that when you run pytest from the command line, it will automatically include these options:

```
$ pytest
```

Would be equivalent to:

```
$ pytest --tb=short --color=yes
```
In a `pytest.ini` file, `addopts` is a configuration option that allows you to specify additional command-line options to be passed to pytest when running tests.

`addopts` is a way to persistently store command-line options that you want to use every time you run pytest, without having to type them out each time. This can be useful for a variety of reasons, such as:

1. **Convenience**: You can save commonly used options, like `--junit-xml` or `--cov`, so you don't have to type them out every time.
2. **Consistency**: Ensure that all team members or CI/CD pipelines use the same set of options when running tests.
3. **Customization**: You can add custom options or plugins that are specific to your project or testing needs.

Here's an example of how you might use `addopts` in a `pytest.ini` file:
```ini
[pytest]
addopts = --junit-xml=report.xml --cov=my_package
```
In this example, when you run `pytest`, it will automatically include the `--junit-xml=report.xml` and `--cov=my_package` options, which will generate a JUnit XML report and collect coverage data for the `my_package` module, respectively.

You can also use `addopts` to specify multiple options, separated by spaces:
```ini
[pytest]
addopts = --junit-xml