<commit_before># Copyright 2014 PressLabs SRL
#
# 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.


import os
import time
import pytest
import string
import shutil

from tests.integrations.base import BaseTest, pull


class TestWriteCurrentView(BaseTest):
    def test_link_a_file(self):
        filename = "%s/link_file" % self.current_path
        link_name = "%s/new_link" % self.current_path

        with open(filename, "w") as f:
            f.write("some content")

        os.link(filename, link_name)

        time.sleep(5)<commit_msg>Close #169: added test for removing a direcotry<commit_after># Copyright 2014 PressLabs SRL
#
# 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.


import os
import time
import pytest
import string
import shutil

from tests.integrations.base import BaseTest, pull


class TestWriteCurrentView(BaseTest):
    def test_rename_directory(self):
        old_dir = "%s/a_directory/" % self.current_path
        new_dir = "%s/some_directory/" % self.current_path
        os.makedirs(old_dir)

        time.sleep(5)
        with pull(self.sh):
            self.assert_new_commit()

        os.rename(old_dir, new_dir)

        time.sleep(5)
        with pull(self.sh):
            self.assert_new_commit()

        assert os.path.isdir(new_dir) is not False
        assert os.path.exists(old_dir) is False

    def test_link_a_file(self):
        filename = "%s/link_file" % self.current_path
        link_name = "%s/new_link" % self.current_path

        with open(filename, "w") as f:
            f.write("some content")

        os.link(filename, link_name)

        time.sleep(5)
{'fraction_non_alphanumeric': 0.08374951978486361, 'fraction_numerical': 0.008835958509412217, 'mean_word_length': 3.2479608482871125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6947521', 'n_tokens_mistral': 763, 'n_tokens_neox': 737, 'n_words': 270}