コード例 #1
0
    def test_build_check(self):
        # Do the initial build.
        assert build_check()[0]
        link_package(self.mock_extension)
        link_package(self.mock_package)
        build()
        assert not build_check()[0]

        # Check installed extensions.
        install_extension(self.mock_mimeextension)
        assert build_check()[0]
        uninstall_extension('@jupyterlab/mime-extension-test')
        assert not build_check()[0]

        # Check linked extensions.
        pkg_path = pjoin(self.mock_extension, 'package.json')
        with open(pkg_path) as fid:
            data = json.load(fid)
        with open(pkg_path, 'rb') as fid:
            orig = fid.read()
        data['foo'] = 'bar'
        with open(pkg_path, 'w') as fid:
            json.dump(data, fid)
        assert build_check()[0]
        assert build_check()[0]

        with open(pkg_path, 'wb') as fid:
            fid.write(orig)
        assert not build_check()[0]

        # Check linked packages.
        pkg_path = pjoin(self.mock_package, 'package.json')
        with open(pkg_path) as fid:
            data = json.load(fid)
        with open(pkg_path, 'rb') as fid:
            orig = fid.read()
        data['foo'] = 'bar'
        with open(pkg_path, 'w') as fid:
            json.dump(data, fid)
        assert build_check()[0]
        assert build_check()[0]

        with open(pkg_path, 'wb') as fid:
            fid.write(orig)
        assert not build_check()[0]
コード例 #2
0
ファイル: test_jupyterlab.py プロジェクト: edithkk/jupyterlab
    def test_build_check(self):
        # Do the initial build.
        assert build_check()
        install_extension(self.mock_extension)
        link_package(self.mock_package)
        build()
        assert not build_check()

        # Check installed extensions.
        install_extension(self.mock_mimeextension)
        assert build_check()
        uninstall_extension(self.pkg_names['mimeextension'])
        assert not build_check()

        # Check local extensions.
        pkg_path = pjoin(self.mock_extension, 'package.json')
        with open(pkg_path) as fid:
            data = json.load(fid)
        with open(pkg_path, 'rb') as fid:
            orig = fid.read()
        data['foo'] = 'bar'
        with open(pkg_path, 'w') as fid:
            json.dump(data, fid)
        assert build_check()
        assert build_check()

        with open(pkg_path, 'wb') as fid:
            fid.write(orig)

        assert not build_check()

        # Check linked packages.
        pkg_path = pjoin(self.mock_package, 'index.js')
        with open(pkg_path, 'rb') as fid:
            orig = fid.read()
        with open(pkg_path, 'wb') as fid:
            fid.write(orig + b'\nconsole.log("hello");')
        assert build_check()
        assert build_check()

        with open(pkg_path, 'wb') as fid:
            fid.write(orig)
        assert not build_check()
コード例 #3
0
    def test_build_check(self):
        # Do the initial build.
        assert build_check()
        assert install_extension(self.mock_extension) is True
        assert link_package(self.mock_package) is True
        build()
        assert not build_check()

        # Check installed extensions.
        assert install_extension(self.mock_mimeextension) is True
        assert build_check()
        assert uninstall_extension(self.pkg_names['mimeextension']) is True
        assert not build_check()

        # Check local extensions.
        pkg_path = pjoin(self.mock_extension, 'package.json')
        with open(pkg_path) as fid:
            data = json.load(fid)
        with open(pkg_path, 'rb') as fid:
            orig = fid.read()
        data['foo'] = 'bar'
        with open(pkg_path, 'w') as fid:
            json.dump(data, fid)
        assert build_check()
        assert build_check()

        with open(pkg_path, 'wb') as fid:
            fid.write(orig)

        assert not build_check()

        # Check linked packages.
        pkg_path = pjoin(self.mock_package, 'index.js')
        with open(pkg_path, 'rb') as fid:
            orig = fid.read()
        with open(pkg_path, 'wb') as fid:
            fid.write(orig + b'\nconsole.log("hello");')
        assert build_check()
        assert build_check()

        with open(pkg_path, 'wb') as fid:
            fid.write(orig)
        assert not build_check()
コード例 #4
0
    def test_build_check(self):
        # Do the initial build.
        assert build_check()
        assert install_extension(self.mock_extension) is True
        assert link_package(self.mock_package) is True
        build()
        assert not build_check()

        # Check installed extensions.
        assert install_extension(self.mock_mimeextension) is True
        assert build_check()
        assert uninstall_extension(self.pkg_names["mimeextension"]) is True
        assert not build_check()

        # Check local extensions.
        pkg_path = pjoin(self.mock_extension, "package.json")
        with open(pkg_path) as fid:
            data = json.load(fid)
        with open(pkg_path, "rb") as fid:
            orig = fid.read()
        data["foo"] = "bar"
        with open(pkg_path, "w") as fid:
            json.dump(data, fid)
        assert build_check()
        assert build_check()

        with open(pkg_path, "wb") as fid:
            fid.write(orig)

        assert not build_check()

        # Check linked packages.
        pkg_path = pjoin(self.mock_package, "index.js")
        with open(pkg_path, "rb") as fid:
            orig = fid.read()
        with open(pkg_path, "wb") as fid:
            fid.write(orig + b'\nconsole.log("hello");')
        assert build_check()
        assert build_check()

        with open(pkg_path, "wb") as fid:
            fid.write(orig)
        assert not build_check()