Skip to content

Commit fee6d50

Browse files
committed
Quick fix
1 parent 7d956f7 commit fee6d50

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

tests/example_configurations/shortened_default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Edit this configuration file to define what should be installed on
44
# your system. Help is available in the configuration.nix(5) man page
5-
# and in the NixOS manual (accessible by running nixos-help).
5+
# and in the NixOS manual (accessible by running `nixos-help`).
66

77
{ config, pkgs, ... }:
88

@@ -52,7 +52,7 @@
5252

5353
# This value determines the NixOS release from which the default
5454
# settings for stateful data, like file locations and database versions
55-
# on your system were taken. Its perfectly fine and recommended to leave
55+
# on your system were taken. It`s perfectly fine and recommended to leave
5656
# this value at the release version of the first install of this system.
5757
# Before changing this value read the documentation for this option
5858
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).

tests/test_comment_collecting.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,62 @@ def test_shortened_default():
99
"""
1010

1111
comment_handler = CommentHandling(Path("./tests/example_configurations/shortened_default.nix"))
12-
assert "{5: [(\'# Edit this configuration file to define what should be installed on\', True), (\'# your system. Help is available in the configuration.nix(5) man page\', True), (\'# and in the NixOS manual (accessible by running ‘nixos-help’).\', True)], 14: [(\'# Define your hostname.\\n\', False)], 16: [(\'# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.\', True)], 20: [(\'# Configure network proxy if necessary\', True), (\'# networking.proxy.default = \"http://user:password@proxy:port/\";\', True), (\'# networking.proxy.noProxy = \"127.0.0.1,localhost,internal.domain\";\', True)], 22: [(\'# Enable networking\', True)], 25: [(\'# Set your time zone.\', True)], 28: [(\'# Select internationalisation properties.\', True)], 31: [(\'# Enable the X11 windowing system.\', True)], 35: [(\'# Enable touchpad support (enabled default in most desktopManager).\', True), (\'# services.xserver.libinput.enable = true;\', True)], 37: [(\'# Install firefox.\', True)], 40: [(\'# Allow unfree packages\', True)], 44: [(\'# List packages installed in system profile. To search, run:\', True), (\'# $ nix search wget\', True)], 51: [(\'# Open ports in the firewall.\', True), (\'# networking.firewall.allowedTCPPorts = [ ... ];\', True), (\'# networking.firewall.allowedUDPPorts = [ ... ];\', True), (\'# Or disable the firewall altogether.\', True), (\'# networking.firewall.enable = false;\', True)], 58: [(\'# This value determines the NixOS release from which the default\', True), (\'# settings for stateful data, like file locations and database versions\', True), (\'# on your system were taken. It‘s perfectly fine and recommended to leave\', True), (\'# this value at the release version of the first install of this system.\', True), (\'# Before changing this value read the documentation for this option\', True), (\'# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).\', True), (\'# Did you read the comment?\\n\', False)]}".replace("\"", '"') == str(comment_handler.get_comments_for_attaching())
12+
assert (
13+
"{5: [(\'# Edit this configuration file to define what should be installed on\', True), (\'# your system. Help is available in the configuration.nix(5) man page\', True), (\'# and in the NixOS manual (accessible by running `nixos-help`).\', True)], "
14+
"14: [(\'# Define your hostname.\\n\', False)], "
15+
"16: [(\'# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.\', True)], "
16+
"20: [(\'# Configure network proxy if necessary\', True), (\'# networking.proxy.default = \"http://user:password@proxy:port/\";\', True), (\'# networking.proxy.noProxy = \"127.0.0.1,localhost,internal.domain\";\', True)], "
17+
"22: [(\'# Enable networking\', True)], "
18+
"25: [(\'# Set your time zone.\', True)], "
19+
"28: [(\'# Select internationalisation properties.\', True)], "
20+
"31: [(\'# Enable the X11 windowing system.\', True)], "
21+
"35: [(\'# Enable touchpad support (enabled default in most desktopManager).\', True), (\'# services.xserver.libinput.enable = true;\', True)], "
22+
"37: [(\'# Install firefox.\', True)], "
23+
"40: [(\'# Allow unfree packages\', True)], "
24+
"44: [(\'# List packages installed in system profile. To search, run:\', True), (\'# $ nix search wget\', True)], "
25+
"51: [(\'# Open ports in the firewall.\', True), (\'# networking.firewall.allowedTCPPorts = [ ... ];\', True), (\'# networking.firewall.allowedUDPPorts = [ ... ];\', True), (\'# Or disable the firewall altogether.\', True), (\'# networking.firewall.enable = false;\', True)], "
26+
"58: [(\'# This value determines the NixOS release from which the default\', True), (\'# settings for stateful data, like file locations and database versions\', True), (\'# on your system were taken. It`s perfectly fine and recommended to leave\', True), (\'# this value at the release version of the first install of this system.\', True), (\'# Before changing this value read the documentation for this option\', True), (\'# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).\', True), (\'# Did you read the comment?\\n\', False)]}"
27+
).replace("\"", '"') == str(comment_handler.get_comments_for_attaching())
1328

1429
def test_yasu_example_config():
1530
"""
1631
Checks if all comments are collected correctly in yasu_example_config.nix configuration
1732
"""
1833

1934
comment_handler = CommentHandling(Path("./tests/example_configurations/yasu_example_config.nix"))
20-
assert "{6: [('# Include the results of the hardware scan.\\n', False)], 13: [('# Define your hostname.\\n', False)], 23: [('#audio', True)], 38: [('# Steam\\n', False)]}".replace("\"", '"') == str(comment_handler.get_comments_for_attaching())
35+
assert (
36+
"{6: [('# Include the results of the hardware scan.\\n', False)], "
37+
"13: [('# Define your hostname.\\n', False)], "
38+
"23: [('#audio', True)], "
39+
"38: [('# Steam\\n', False)]}"
40+
).replace("\"", '"') == str(comment_handler.get_comments_for_attaching())
2141

2242
def test_pms_example_config():
2343
"""
2444
Checks if all comments are collected correctly in pms_example_config.nix configuration
2545
"""
2646

2747
comment_handler = CommentHandling(Path("./tests/example_configurations/pms_example_config.nix"))
28-
assert "{6: [('# Edit this configuration file to define what should be installed on', True), ('# your system. Help is available in the configuration.nix(5) man page', True), ('# and in the NixOS manual (accessible by running `nixos-help`).', True)], 11: [('# Include the results of the hardware scan.\\n', False)], 16: [('# Use the systemd-boot EFI boot loader.', True)], 22: [('#boot.zfs.extraPools = [ \"zfstest\" ];', True)], 57: [('# badblocks\\n', False)], 97: [('#defaultSession = \"xfce+bspwm\";', True)], 110: [('# make shares visible for windows 10 clients\\n', False)]}".replace("\"", '"') == str(comment_handler.get_comments_for_attaching())
48+
assert (
49+
"{6: [('# Edit this configuration file to define what should be installed on', True), ('# your system. Help is available in the configuration.nix(5) man page', True), ('# and in the NixOS manual (accessible by running `nixos-help`).', True)], "
50+
"11: [('# Include the results of the hardware scan.\\n', False)], "
51+
"16: [('# Use the systemd-boot EFI boot loader.', True)], "
52+
"22: [('#boot.zfs.extraPools = [ \"zfstest\" ];', True)], "
53+
"57: [('# badblocks\\n', False)], "
54+
"97: [('#defaultSession = \"xfce+bspwm\";', True)], "
55+
"110: [('# make shares visible for windows 10 clients\\n', False)]}"
56+
).replace("\"", '"') == str(comment_handler.get_comments_for_attaching())
2957

3058
def test_random():
3159
"""
3260
Checks if all comments are collected correctly in random.nix configuration
3361
"""
3462

3563
comment_handler = CommentHandling(Path("./tests/example_configurations/random.nix"))
36-
assert "{3: [('# To test multiline headers', True)], 9: [('# from hardware_configuration.nix bundled in a install of Nix-OS', True)], 12: [('# networking.interfaces.ens33.useDHCP = lib.mkDefault true;', True)], 16: [('# To test lib.mkForce, taken from https://search.nixos.org/options?channel=24.11&show=boot.supportedFilesystems&from=0&size=50&sort=relevance&type=packages&query=lib.mkForce', True)], 23: [('# Testing integers', True)]}".replace("\"", '"') == str(comment_handler.get_comments_for_attaching())
64+
assert (
65+
"{3: [('# To test multiline headers', True)], "
66+
"9: [('# from hardware_configuration.nix bundled in a install of Nix-OS', True)], "
67+
"12: [('# networking.interfaces.ens33.useDHCP = lib.mkDefault true;', True)], "
68+
"16: [('# To test lib.mkForce, taken from https://search.nixos.org/options?channel=24.11&show=boot.supportedFilesystems&from=0&size=50&sort=relevance&type=packages&query=lib.mkForce', True)], "
69+
"23: [('# Testing integers', True)]}"
70+
).replace("\"", '"') == str(comment_handler.get_comments_for_attaching())

0 commit comments

Comments
 (0)