Repository: Textualize/rich

Issue:
[BUG] reconfiguring rich via pytest at runtime
**Describe the bug**

Trying to reconfigure rich when my code is run via pytest, using the following pytest hook:

```python
# conftest.py

def pytest_configure():
    try:
        import rich
    except ImportError:
        pass
    else:
        rich.reconfigure(soft_wrap=False)
```

and invoking my tests with
```shell
pytest
```

I got the following error:

```
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/_pytest/main.py", line 265, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/_pytest/config/__init__.py", line 982, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/robcleme/dev/my/wxc/tests/conftest.py", line 33, in pytest_configure
INTERNALERROR>     rich.reconfigure(soft_wrap=False)
INTERNALERROR>   File "/Users/robcleme/.pyenv/versions/wxc-dev/lib/python3.9/site-packages/rich/__init__.py", line 45, in reconfigure
INTERNALERROR>     _console.__dict__ = new_console.__dict__
INTERNALERROR> AttributeError: 'NoneType' object has no attribute '__dict__'
```

**Platform**
OsX

**Diagnose**

```
python -m rich.diagnose
python -m rich._windows
pip freeze | grep rich
```
```
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface.                                                  │
│                                                                                  │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=185 ColorSystem.TRUECOLOR>                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                  │
│     color_system = 'truecolor'                                                   │
│         encoding = 'utf-8'                                                       │
│             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│           height = 52                                                            │
│    is_alt_screen = False                                                         │
│ is_dumb_terminal = False                                                         │
│   is_interactive = True                                                          │
│       is_jupyter = False                                                         │
│      is_terminal = True                                                          │
│   legacy_windows = False                                                         │
│         no_color = False                                                         │
│          options = ConsoleOptions(                                               │
│                        size=ConsoleDimensions(width=185, height=52),             │
│                        legacy_windows=False,                                     │
│                        min_width=1,                                              │
│                        max_width=185,                                            │
│                        is_terminal=True,                                         │
│                        encoding='utf-8',                                         │
│                        max_height=52,                                            │
│                        justify=None,                                             │
│                        overflow=None,                                            │
│                        no_wrap=False,                                            │
│                        highlight=None,                                           │
│                        markup=None,                                              │
│                        height=None                                               │
│                    )                                                             │
│            quiet = False                                                         │
│           record = False                                                         │
│         safe_box = True                                                          │
│             size = ConsoleDimensions(width=185, height=52)                       │
│        soft_wrap = False                                                         │
│           stderr = False                                                         │
│            style = None                                                          │
│         tab_size = 8                                                             │
│            width = 185                                                           │
╰──────────────────────────────────────────────────────────────────────────────────╯
platform="Darwin"
WindowsConsoleFeatures(vt=False, truecolor=False)
rich==10.7.0
```




Discussion:

Resolving patch:
diff --git a/rich/__init__.py b/rich/__init__.py
--- a/rich/__init__.py
+++ b/rich/__init__.py
@@ -41,6 +41,7 @@ def reconfigure(*args: Any, **kwargs: Any) -> None:
     from rich.console import Console
 
     new_console = Console(*args, **kwargs)
+    _console = get_console()
     _console.__dict__ = new_console.__dict__
 
 


Test patch: