BLD: Add pyproject.toml to wheels
State: closed

- [ ] closes #50302 (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Labels:
name: Build
description: Library building on various platforms

Comments:
Thanks! Should we add a custom `pytest.mark.smoketest` mark in pyproject.toml so we can have a build that builds a wheel and runs `pd.test` with `-m smoketest`?
Well, the wheel builder failures show that this definetely fixes it.

I've also done a slight modification to make --strict-data-files opt out instead of opt in. This also have the benefit of not showing a confusing no such option error, when you mistype in the path to a test you want to run. (you also can do just pytest now in the pandas directory, instead of doing pytest pandas)
> Thanks! Should we add a custom `pytest.mark.smoketest` mark in pyproject.toml so we can have a build that builds a wheel and runs `pd.test` with `-m smoketest`?

Sorry, can you clarify what a smoke test would mean in our test suite?
Ah sorry. Not sure if it's too involved but a test in like `pandas/tests/test_pd_test.py`

```
@pytest.mark.smoketest
def test_pd_test_markers():
     assert True
```

Then something that runs `pd.test(["-m smoketest"])` checking that only one test gets run?
> Ah sorry. Not sure if it's too involved but a test in like `pandas/tests/test_pd_test.py`
> 
> ```
> @pytest.mark.smoketest
> def test_pd_test_markers():
>      assert True
> ```
> 
> Then something that runs `pd.test(["-m smoketest"])` checking that only one test gets run?

I think markers are still working, but just raising the unknown marker warning. I'll probably add a test to check that pyproject.toml can be found instead.
Curious, why are the wheels only tested on windows?

Also might be worth to error on warnings from pytest when running the tests?
> Curious, why are the wheels only tested on windows?

Linux/macOS is tested by cibuildwheel directly here.
https://github.com/lithomas1/pandas/blob/a21dc267e0a2612a179e4f4878f5eacb7e4eab8a/pyproject.toml#L150

Windows is done in a separate step, since we test in an empty Docker container without MSVC installed to ensure that all DLLs are packaged in with the wheels.

> Also might be worth to error on warnings from pytest when running the tests?

I'll look into enabling erroring on warnings.
Looks like `test_encoding_latin1_118` failed during wheel testing because a file wasn't found?
Looks pretty good. Appears these tests need to filter out potential RuntimeWarnings

```
pandas/tests/series/methods/test_nlargest.py::TestSeriesNLargestNSmallest::test_nlargest_nullable
pandas/tests/frame/indexing/test_setitem.py::TestDataFrameSetItem::test_setitem_dtype
```
Awesome! Thanks @lithomas1