<s> from squadron import setup <EOL> import os <EOL> import mock <EOL> def test_system ( tmpdir ) : <EOL> tmpdir = str ( tmpdir ) <EOL> etcdir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' ) <EOL> vardir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' ) <EOL> setup . init_system ( etcdir , vardir ) <EOL> assert os . path . exists ( os . path . join ( etcdir , '<STR_LIT>' ) ) <EOL> assert os . path . exists ( os . path . join ( vardir , '<STR_LIT>' ) ) <EOL> def test_setup ( tmpdir ) : <EOL> tmpdir = str ( tmpdir ) <EOL> etcdir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> vardir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> with mock . patch ( '<STR_LIT>' , side_effect = [ etcdir , vardir ] ) : <EOL> setup . setup ( None , None ) <EOL> assert os . path . exists ( os . path . join ( etcdir , '<STR_LIT>' ) ) <EOL> assert os . path . exists ( os . path . join ( vardir , '<STR_LIT>' ) ) <EOL> etcdir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> vardir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> with mock . patch ( '<STR_LIT>' , return_value = etcdir ) : <EOL> setup . setup ( None , vardir ) <EOL> assert os . path . exists ( os . path . join ( etcdir , '<STR_LIT>' ) ) <EOL> assert os . path . exists ( os . path . join ( vardir , '<STR_LIT>' ) ) <EOL> etcdir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> vardir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> with mock . patch ( '<STR_LIT>' , return_value = vardir ) : <EOL> setup . setup ( etcdir , None ) <EOL> assert os . path . exists ( os . path . join ( etcdir , '<STR_LIT>' ) ) <EOL> assert os . path . exists ( os . path . join ( vardir , '<STR_LIT>' ) ) <EOL> etcdir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> vardir = os . path . join ( tmpdir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> with mock . patch ( '<STR_LIT>' , side_effect = Exception ( '<STR_LIT>' ) ) : <EOL> setup . setup ( etcdir , vardir ) <EOL> assert os . path . exists ( os . path . join ( etcdir , '<STR_LIT>' ) ) <EOL> assert os . path . exists ( os . path . join ( vardir , '<STR_LIT>' ) ) </s>
