black/tests
Cooper Lees 5bb4da02c2
Add cpython Lib/ repository config into primer config - Disabled (#2429)
* Add CPython repository into primer runs

- CPython tests is probably the best repo for black to test on as the stdlib's unittests should use all syntax
  - Limit to running in recent versions of the python runtime - e.g. today >= 3.9
    - This allows us to parse more syntax
- Exclude all failing files for now
  - Definitely have bugs to explore there - Refer to #2407 for more details there
  - Some test files on purpose have syntax errors, so we will never be able to parse them
- Add new black command arguments logging in debug mode; very handy for seeing how CLI arguments are formatted

CPython now succeeds ignoring 16 files:
```
Oh no! 💥 💔 💥
1859 files would be reformatted, 148 files would be left unchanged.
```

Testing
- Ran locally with and without string processing - Very little runtime difference BUT 3 more failed files
```
time /tmp/tb/bin/black --experimental-string-processing --check . 2>&1 | tee /tmp/black_cpython_esp
...
Oh no! 💥 💔 💥
1859 files would be reformatted, 148 files would be left unchanged, 16 files would fail to reformat.

real	4m8.563s
user	16m21.735s
sys	0m6.000s
```
- Add unittest for new covienence config file flattening that allows long arguments to be broke up into an array/list of strings

Addresses #2407

---

Commit history before merge:

* Add new `timeout_seconds` support into primer.json
- If present, will set forked process limit to that value in seconds
- Otherwise, stay with default 10 minutes (600 seconds)

* Add new "base_path" concept to black-primer
- Rather than start at the repo root start at a configured path within the repository
  - e.g. for cpython only run black on `Lib`

* Disable by default - It's too much for GitHub Actions. But let's leave config for others to use
* Minor tweak to _flatten_cli_args

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2021-08-24 17:29:49 -04:00
..
data Improve f-string expression detection regex so ... (#2437) 2021-08-22 19:52:19 -07:00
__init__.py Remove deprecated use of 'setup.py test' (#1275) 2020-05-08 06:23:50 -07:00
conftest.py Use optional tests for "no_python2" to simplify local testing (#2203) 2021-05-07 15:03:13 +02:00
empty.toml Add --target-version option to allow users to choose targeted Python versions (#618) 2019-02-06 18:43:50 -08:00
optional.py Use optional tests for "no_python2" to simplify local testing (#2203) 2021-05-07 15:03:13 +02:00
test_black.py Present a more user-friendly error if .gitignore is invalid (#2414) 2021-08-20 19:54:53 -04:00
test_blackd.py Mark blackd tests with the blackd optional marker (#2204) 2021-05-07 16:33:36 +02:00
test_format.py Possible fix for issue with indentation and fmt: skip (#2281) 2021-06-08 14:37:34 -07:00
test_ipynb.py Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
test_no_ipynb.py Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
test_primer.py Add cpython Lib/ repository config into primer config - Disabled (#2429) 2021-08-24 17:29:49 -04:00
test.toml Switch toml TOML library for tomli (#2301) 2021-07-12 16:01:38 -04:00
util.py add context manager to temporarily change the cwd (#2377) 2021-07-16 22:21:34 -04:00