Example #1
0
    def test_read_json_from_file(self):
        with isolated_filesystem():
            with open(self.filename, 'w') as f:
                f.write(json.dumps(self.dictionary))

            loader = JSONFileLoader()
            loaded_dict = loader.load_file(self.filename)
            self.assertEqual(self.dictionary, loaded_dict)
Example #2
0
    def setUp(self):
        self.dirname = 'foo'
        self.filename = ['foo.bar', 'foo.baz']
        self.filedatas = ['foo bar baz', 'helloworld']
        self.fs = isolated_filesystem()
        self.fs.__enter__()
        self.stage_config = PipelineStageConfig(
            "test_stage_name", {"type": "LocalFilePipelineStage"})

        # Build directory structure
        os.makedirs(self.dirname)
        for name, data in zip(self.filename, self.filedatas):
            with open(os.path.join(os.getcwd(), self.dirname, name), 'w') as f:
                f.write(data)
Example #3
0
    def setUp(self):
        self.config_filename = 'pipetree.json'
        self.testfile_name = 'testfile'
        self.testfile_contents = "Testfile Contents"
        self.fs = isolated_filesystem()
        self.fs.__enter__()

        with open(os.path.join(".", self.testfile_name), 'w') as f:
            f.write(self.testfile_contents)

        with open(os.path.join(".", self.config_filename), 'w') as f:
            json.dump(self.generate_pipeline_config(), f)

        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)
Example #4
0
    def setUp(self):
        # File system configuration
        self.filename = ['foo.bar', 'foo.baz']
        self.filedatas = ['foo bar baz', 'hello, world']
        self.fs = isolated_filesystem()
        self.fs.__enter__()

        for name, data in zip(self.filename, self.filedatas):
            with open(os.path.join(os.getcwd(), name), 'w') as f:
                f.write(data)

        # Setup stage config
        self.stage_config = PipelineStageConfig(
            "test_stage_name", {
                "type": "ParameterPipelineStage",
                "param_a": "string parameter value"
            })
Example #5
0
    def setUp(self):
        self.dirname = 'foo'
        self.filename = 'bar'
        self.data = 'The charming anatomy of vestigial organs'
        self.factory = PipelineFactory()
        self.fs = isolated_filesystem()
        self.fs.__enter__()
        os.makedirs(self.dirname)

        with open(os.path.join(os.getcwd(),
                               self.dirname,
                               self.filename), 'w') as f:
            f.write(self.data)

        # Create package/file.py for executor tests
        os.makedirs("package")
        with open(os.path.join(os.getcwd(),
                               "package",
                               "file.py"), 'w') as f:
            f.write('def function(): yield ["a", "b", "c"]')
Example #6
0
    def setUp(self):
        # File system configuration
        self.filename = ['foo.bar', 'foo.baz']
        self.filedatas = ['foo bar baz', 'hello, world']
        self.fs = isolated_filesystem()
        self.fs.__enter__()
        
        for name, data in zip(self.filename, self.filedatas):
            with open(os.path.join(os.getcwd(),
                                   name), 'w') as f:
                f.write(data)

        # Setup settings for local arbiter
        self.stage_config = PipelineStageConfig("test_stage_name", {
            "type": "ParameterPipelineStage"
        })
        self.config_filename = 'pipetree.json'
        with open(os.path.join(".", self.config_filename), 'w') as f:
            json.dump(self.generate_pipeline_config(), f)

        # Cleanup before each test is run
        self.cleanup_test_tables(self._default_backend)            
Example #7
0
 def setUp(self):
     self.filename = 'file.json'
     self.factory = PipelineStageFactory()
     self.fs = isolated_filesystem()
     self.fs.__enter__()