# limitations under the License. from __future__ import print_function from os import path as os_path import tempfile import shutil import time import unittest import whisper from biggraphite.cli import import_whisper from biggraphite import test_utils as bg_test_utils bg_test_utils.prepare_graphite_imports() class TestUtils(unittest.TestCase): def test_metric_name_from_wsp(self): examples = [ ("/tmp/", "/tmp/a/b/c.wsp", "a.b.c"), ("/tmp", "/tmp/a/b/c.wsp", "a.b.c"), ("/", "/a/b/c.wsp", "a.b.c"), ] for root, wsp, name in examples: self.assertEqual(name, import_whisper.metric_name_from_wsp(root, wsp)) class TestMain(bg_test_utils.TestCaseWithFakeAccessor):
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import print_function from biggraphite import test_utils as bg_test_utils # noqa bg_test_utils.prepare_graphite_imports() # noqa import unittest from carbon import exceptions as carbon_exceptions from carbon import util as carbon_util import mock from biggraphite.cli import bg_carbon_cache class TestMain(unittest.TestCase): def test_runs(self): sys_path = [] with mock.patch.object(carbon_util, "run_twistd_plugin",