def set_up(self):
        """Set up your applications and the test environment."""
        self.path.state = self.path.gen.joinpath("state")
        if self.path.state.exists():
            self.path.state.rmtree(ignore_errors=True)
        self.path.state.mkdir()

        for script in self.given.get("scripts", []):
            script_path = self.path.state.joinpath(script)

            if not script_path.dirname().exists():
                script_path.dirname().makedirs()

            script_path.write_text(self.given["scripts"][script])
            script_path.chmod("u+x")

        for filename, contents in self.given.get("files", {}).items():
            self.path.state.joinpath(filename).write_text(contents)

        self.python = hitchpylibrarytoolkit.project_build(
            "commandlib", self.path, self.given["python version"]
        ).bin.python

        self.example_py_code = (
            ExamplePythonCode(self.python, self.path.state)
            .with_code(self.given.get("code", ""))
            .with_setup_code(self.given.get("setup", ""))
        )
def set_up ( self ) : self . path . state = self . path . gen . joinpath ( "state" ) if self . path . state . exists ( ) : self . path . state . rmtree ( ignore_errors = True ) self . path . state . mkdir ( ) for script in self . given . get ( "scripts" , [ ] ) : script_path = self . path . state . joinpath ( script ) if not script_path . dirname ( ) . exists ( ) : script_path . dirname ( ) . makedirs ( ) script_path . write_text ( self . given [ "scripts" ] [ script ] ) script_path . chmod ( "u+x" ) for filename , contents in self . given . get ( "files" , { } ) . items ( ) : self . path . state . joinpath ( filename ) . write_text ( contents ) self . python = hitchpylibrarytoolkit . project_build ( "commandlib" , self . path , self . given [ "python version" ] ) . bin . python self . example_py_code = ( ExamplePythonCode ( self . python , self . path . state ) . with_code ( self . given . get ( "code" , "" ) ) . with_setup_code ( self . given . get ( "setup" , "" ) ) )
Set up your applications and the test environment.