| Conditions | 2 |
| Total Lines | 62 |
| Code Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | #!/usr/bin/env python |
||
| 68 | @pytest.mark.dependency(depends=["test_00_environment_clear"]) |
||
| 69 | def test_01_install(): |
||
| 70 | """Creates a new default instances and clears it without archiving""" |
||
| 71 | pytest.reset_base(unset_instance=True) |
||
| 72 | import os |
||
| 73 | import pwd |
||
| 74 | |||
| 75 | def get_username(): |
||
| 76 | """Return current username""" |
||
| 77 | return pwd.getpwuid(os.getuid())[0] |
||
| 78 | |||
| 79 | _ = pytest.run_cli(isotool, ['instance', 'create'], full_log=True) |
||
| 80 | _ = pytest.run_cli(isotool, ['instance', 'set', 'user', get_username()], |
||
| 81 | full_log=True) |
||
| 82 | _ = pytest.run_cli(isotool, ['environment', 'clear', '--no-archive'], full_log=True) |
||
| 83 | |||
| 84 | # assert os.path.exists('/tmp/isomer-test/etc/isomer/instances/' + |
||
| 85 | # pytest.INSTANCENAME + '.conf') |
||
| 86 | # assert os.path.exists('/tmp/isomer-test/var/lib/isomer/' + |
||
| 87 | # pytest.INSTANCENAME + '/green') |
||
| 88 | |||
| 89 | repo_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')) |
||
| 90 | |||
| 91 | result = pytest.run_cli( |
||
| 92 | isotool, |
||
| 93 | ['environment', 'install', '--no-sudo', '--source', 'copy', |
||
| 94 | '--url', repo_path, '--skip-provisions', '--skip-frontend'], |
||
| 95 | full_log=True |
||
| 96 | ) |
||
| 97 | |||
| 98 | assert result.exit_code == 0 |
||
| 99 | |||
| 100 | # assert os.path.exists('/tmp/isomer-test/var/lib/isomer/' + |
||
| 101 | # pytest.INSTANCENAME + '/green') |
||
| 102 | # assert os.path.exists('/tmp/isomer-test/var/cache/isomer/' + |
||
| 103 | # pytest.INSTANCENAME + '/green') |
||
| 104 | # assert os.path.exists('/tmp/isomer-test/var/local/isomer/' + |
||
| 105 | # pytest.INSTANCENAME + '/green') |
||
| 106 | # assert os.path.exists( |
||
| 107 | # '/tmp/isomer-test/var/lib/isomer/' + |
||
| 108 | # pytest.INSTANCENAME + '/green/venv/bin/python3') |
||
| 109 | # assert os.path.exists('/tmp/isomer-test/var/lib/isomer/' + |
||
| 110 | # pytest.INSTANCENAME + '/green/venv/bin/iso') |
||
| 111 | # assert os.path.exists('/tmp/isomer-test/var/lib/isomer/' + |
||
| 112 | # pytest.INSTANCENAME + '/green/repository') |
||
| 113 | # assert os.path.exists( |
||
| 114 | # '/tmp/isomer-test/var/lib/isomer/' + |
||
| 115 | # pytest.INSTANCENAME + '/green/repository/frontend') |
||
| 116 | |||
| 117 | instance_configuration = load_instance(pytest.INSTANCENAME) |
||
| 118 | environment = instance_configuration['environments']['green'] |
||
| 119 | |||
| 120 | assert environment['installed'] is True |
||
| 121 | assert environment['provisioned'] is False |
||
| 122 | assert environment['migrated'] is True |
||
| 123 | assert environment['frontend'] is False |
||
| 124 | assert environment['tested'] is False |
||
| 125 | assert environment['database'] == pytest.INSTANCENAME + '_green' |
||
| 126 | |||
| 127 | if result.exit_code != 0: |
||
| 128 | print(result.output) |
||
| 129 | print("For more information on possibly failed subtasks, " |
||
| 130 | "consult /tmp/isomer_test_run_cli_logfile") |
||
| 131 |