CI: fix failing script/tests
- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [ ] whatsnew entry

> Also, tokenize-rt is a dependency of pyupgrade so I didn't think it would be necessary to include it in the environment file

Makes sense, will revert > bit confused here, don't these tests pass already? I just tried pull master and they seem fine:

what flake8 version are you using? > Running from the root directory also works:

```
$ pytest scripts/
______________________________________ ERROR collecting scripts/tests/test_inconsistent_namespace_check.py ______________________________________
ImportError while importing test module '~/pd/pandas/scripts/tests/test_inconsistent_namespace_check.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
scripts/tests/test_inconsistent_namespace_check.py:3: in <module>
    from scripts.check_for_inconsistent_pandas_namespace import (
E   ModuleNotFoundError: No module named 'scripts'

$ cd scripts
$ pytest
______________________________________ ERROR collecting scripts/tests/test_inconsistent_namespace_check.py ______________________________________
ImportError while importing test module '~/pd/pandas/scripts/tests/test_inconsistent_namespace_check.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_inconsistent_namespace_check.py:3: in <module>
    from scripts.check_for_inconsistent_pandas_namespace import (
E   ModuleNotFoundError: No module named 'scripts'

``` cool merge when ready @MarcoGorelli @jbrockmendel  > > bit confused here, don't these tests pass already? I just tried pull master and they seem fine:
> 
> what flake8 version are you using?

Ah yeah, I had 3.8.4, hadn't done `conda env update -f environment.yml`...I thought we'd solved the issues with inconsistent linter versions, but this check uses the conda env version. IMO it makes sense to move it to pre-commit too so this doesn't happen again, will work on that later

Thanks for fixing this + explaining!

---

Just to clarify, it's not #40439  which broke the check, but the fact that `flake8` isn't pinned in `environment.yml`, as that's the version used by this check @meeseeksdev backport 1.2.x Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
$ git checkout 1.2.x
$ git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
$ git cherry-pick -m1 dc548fd7e63581abe4407d6b5fd7ef39e5e9b6e3
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
$ git commit -am 'Backport PR #40457: CI: fix failing script/tests'
```

4. Push to a named branch :

```
git push YOURFORK 1.2.x:auto-backport-of-pr-40457-on-1.2.x
```

5. Create a PR against branch 1.2.x, I would have named this PR:

> "Backport PR #40457 on branch 1.2.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                