codecov-io: # [Codecov](https://codecov.io/gh/repobee/repobee/pull/300?src=pr&el=h1) Report
> Merging [#300](https://codecov.io/gh/repobee/repobee/pull/300?src=pr&el=desc) into [master](https://codecov.io/gh/repobee/repobee/commit/48ea2acf09163bff99e2105e865d7c0cc2fcf8c9?src=pr&el=desc) will **decrease** coverage by `0.11%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/repobee/repobee/pull/300/graphs/tree.svg?width=650&token=5vOKgkphZe&height=150&src=pr)](https://codecov.io/gh/repobee/repobee/pull/300?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##           master    #300      +/-   ##
=========================================
- Coverage   90.31%   90.2%   -0.12%     
=========================================
  Files          21      21              
  Lines        1539    1541       +2     
  Branches      275     275              
=========================================
  Hits         1390    1390              
- Misses        124     127       +3     
+ Partials       25      24       -1
```


| [Impacted Files](https://codecov.io/gh/repobee/repobee/pull/300?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/\_repobee/ext/configwizard.py](https://codecov.io/gh/repobee/repobee/pull/300/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2V4dC9jb25maWd3aXphcmQucHk=) | `100% <100%> (ø)` | :arrow_up: |
| [src/\_repobee/cli.py](https://codecov.io/gh/repobee/repobee/pull/300/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NsaS5weQ==) | `98.09% <0%> (-0.64%)` | :arrow_down: |
| [src/\_repobee/ext/gitlab.py](https://codecov.io/gh/repobee/repobee/pull/300/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2V4dC9naXRsYWIucHk=) | `64.63% <0%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/repobee/repobee/pull/300?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/repobee/repobee/pull/300?src=pr&el=footer). Last update [48ea2ac...6c6488e](https://codecov.io/gh/repobee/repobee/pull/300?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/src/_repobee/ext/configwizard.py b/src/_repobee/ext/configwizard.py
index a8cc05b..c1a7176 100644
--- a/src/_repobee/ext/configwizard.py
+++ b/src/_repobee/ext/configwizard.py
@@ -9,6 +9,7 @@ a short configuration wizard that lets the user set RepoBee's defaults.
 import argparse
 import configparser
 import sys
+import os
 
 import daiquiri
 import repobee_plug as plug
@@ -38,6 +39,9 @@ def callback(args: argparse.Namespace, api: apimeta.API) -> None:
             return
         parser.read(str(constants.DEFAULT_CONFIG_FILE))
 
+    os.makedirs(
+        str(constants.DEFAULT_CONFIG_FILE.parent), mode=0o700, exist_ok=True
+    )
     if constants.DEFAULTS_SECTION_HDR not in parser:
         parser.add_section(constants.DEFAULTS_SECTION_HDR)
 

Config wizard fails if the configuration directory does not exist
Derp, if e.g. `~/.config/repobee` doesn't exist, it must be created.
diff --git a/tests/unit_tests/plugin_tests/test_configwizard.py b/tests/unit_tests/plugin_tests/test_configwizard.py
index 5bf970b..c748f9a 100644
--- a/tests/unit_tests/plugin_tests/test_configwizard.py
+++ b/tests/unit_tests/plugin_tests/test_configwizard.py
@@ -1,5 +1,6 @@
 import string
 import sys
+import os
 import collections
 import builtins  # noqa: F401
 import configparser
@@ -163,3 +164,16 @@ def test_retains_values_that_are_not_specified(config_mock, defaults_options):
         assert parser[_repobee.constants.DEFAULTS_SECTION_HDR][option] == value
     for option, value in plugin_options.items():
         assert parser[plugin_section][option] == value
+
+
+def test_creates_directory(config_mock, tmpdir, defaults_options):
+    with patch(
+        "builtins.input", side_effect=["yes"] + list(defaults_options.values())
+    ), patch("os.makedirs", autospec=True) as makedirs_mock, patch(
+        "pathlib.Path.exists", autospec=True, return_value=False
+    ):
+        configwizard.callback(None, None)
+
+    makedirs_mock.assert_called_once_with(
+        os.path.dirname(str(config_mock)), mode=0o700, exist_ok=True
+    )

pip install -e .[TEST]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-mock codecov
apt-get update apt-get install -y gcc
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
appdirs==1.4.4
certifi @ file:///croot/certifi_1671487769961/work/certifi
cffi==1.15.1
charset-normalizer==3.4.1
codecov==2.1.13
colored==1.4.4
coverage==7.2.7
cryptography==44.0.2
daiquiri==3.2.1
Deprecated==1.2.18
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.2.0
pycparser==2.21
PyGithub==2.3.0
PyJWT==2.8.0
PyNaCl==1.5.0
pytest==7.4.4
pytest-cov==4.1.0
pytest-mock==3.11.1
python-gitlab==1.8.0
python-json-logger==3.0.1
-e git+https://github.com/repobee/repobee.git@48ea2acf09163bff99e2105e865d7c0cc2fcf8c9#egg=repobee
repobee-plug==0.7.0
requests==2.31.0
six==1.17.0
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
wrapt==1.16.0
zipp==3.15.0

name: repobee
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - appdirs==1.4.4
      - cffi==1.15.1
      - charset-normalizer==3.4.1
      - codecov==2.1.13
      - colored==1.4.4
      - coverage==7.2.7
      - cryptography==44.0.2
      - daiquiri==3.2.1
      - deprecated==1.2.18
      - exceptiongroup==1.2.2
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - packaging==24.0
      - pluggy==1.2.0
      - pycparser==2.21
      - pygithub==2.3.0
      - pyjwt==2.8.0
      - pynacl==1.5.0
      - pytest==7.4.4
      - pytest-cov==4.1.0
      - pytest-mock==3.11.1
      - python-gitlab==1.8.0
      - python-json-logger==3.0.1
      - repobee==1.6.0
      - repobee-plug==0.7.0
      - requests==2.31.0
      - six==1.17.0
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - wrapt==1.16.0
      - zipp==3.15.0
prefix: /opt/conda/envs/repobee

tests/unit_tests/plugin_tests/test_configwizard.py::test_creates_directory
tests/unit_tests/plugin_tests/test_configwizard.py::test_ext_command_does_not_require_api tests/unit_tests/plugin_tests/test_configwizard.py::test_exits_when_config_file_exists_and_user_enters_no tests/unit_tests/plugin_tests/test_configwizard.py::test_enters_values_if_config_file_exists_and_user_enters_yes tests/unit_tests/plugin_tests/test_configwizard.py::test_enters_values_without_continue_prompt_if_no_config_exists tests/unit_tests/plugin_tests/test_configwizard.py::test_skips_empty_values tests/unit_tests/plugin_tests/test_configwizard.py::test_retains_values_that_are_not_specified
src/_repobee/ext/configwizard.py
src/_repobee/ext/configwizard.py