Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/pydoctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ jobs:
pip install pydoctor
- name: Build API docs
run: |
# Remove Rust proc-macro .so build artifacts that confuse pydoctor
find subvertpy -name 'lib*.so' -delete
# Work around pydoctor bug: _parseFile only catches SyntaxError but
# binary .so files raise UnicodeDecodeError, causing an UnboundLocalError crash.
sed -i 's/except SyntaxError/except (SyntaxError, UnicodeDecodeError)/g' \
"$(python -c 'import pydoctor.astbuilder; print(pydoctor.astbuilder.__file__)')"
pydoctor --introspect-c-modules -c subvertpy.cfg --make-html subvertpy
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ edition = "2021"
[workspace.dependencies]
pyo3 = { version = "0.27" }
#subversion = { version = ">=0.0.5" }
subversion = { version = "0.1.6" }
subversion = { version = "0.1.10" }
#subversion = { path = "../subversion-rs" }
pyo3-filelike = { version = "0.5" }
1 change: 1 addition & 0 deletions subvertpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
ERR_WC_NOT_WORKING_COPY = ERR_WC_NOT_DIRECTORY = 155007
ERR_ENTRY_EXISTS = 150002
ERR_WC_PATH_NOT_FOUND = 155010
ERR_WC_PATH_UNEXPECTED_STATUS = 155035
ERR_CANCELLED = 200015
ERR_WC_UNSUPPORTED_FORMAT = 155021
ERR_UNKNOWN_CAPABILITY = 200026
Expand Down
157 changes: 157 additions & 0 deletions tests/test_wc.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,163 @@ def test_process_committed_queue_requires_write_lock(self):
)


def test_context_manager(self):
with wc.Context() as ctx:
self.assertIsNotNone(ctx)
result = ctx.locked(os.path.abspath("checkout"))
self.assertIsInstance(result, tuple)

def test_close(self):
ctx = wc.Context()
ctx.close()


class AdmObjTests(SubversionTestCase):
def setUp(self):
super().setUp()
self.repos_url = self.make_client("repos", "checkout")
self._adm = None

def tearDown(self):
if self._adm is not None:
self._adm.close()
self._adm = None
super().tearDown()

def _open_adm(self, **kwargs):
self._adm = wc.Adm(**kwargs)
return self._adm

def test_open(self):
adm = self._open_adm(path=os.path.abspath("checkout"), write_lock=False)
self.assertIsNotNone(adm)

def test_open_positional(self):
self._adm = wc.Adm(None, os.path.abspath("checkout"))
self.assertIsNotNone(self._adm)

def test_open_no_path(self):
self.assertRaises(TypeError, wc.Adm)

def test_open_none_path(self):
self.assertRaises(TypeError, wc.Adm, None, None)

def test_access_path(self):
adm = self._open_adm(path=os.path.abspath("checkout"), write_lock=False)
self.assertEqual(
os.path.normpath(os.path.abspath("checkout")),
os.path.normpath(adm.access_path()),
)

def test_is_locked_read(self):
adm = self._open_adm(path=os.path.abspath("checkout"), write_lock=False)
self.assertFalse(adm.is_locked())

def test_is_locked_write(self):
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=True, depth=-1
)
self.assertTrue(adm.is_locked())

def test_context_manager(self):
with wc.Adm(path=os.path.abspath("checkout"), write_lock=False) as adm:
self.assertIsNotNone(adm)
self.assertEqual(
os.path.normpath(os.path.abspath("checkout")),
os.path.normpath(adm.access_path()),
)

def test_is_wc_root(self):
adm = self._open_adm(path=os.path.abspath("checkout"), write_lock=False)
self.assertTrue(adm.is_wc_root(os.path.abspath("checkout")))

def test_prop_set_get(self):
self.build_tree({"checkout/proptest": b"content"})
self.client_add("checkout/proptest")
self.client_commit("checkout", message="add proptest")
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=True, depth=-1
)
adm.prop_set("svn:eol-style", b"native", os.path.abspath("checkout/proptest"))
val = adm.prop_get("svn:eol-style", os.path.abspath("checkout/proptest"))
self.assertEqual(b"native", val)

def test_prop_get_nonexistent(self):
self.build_tree({"checkout/propnone": b"content"})
self.client_add("checkout/propnone")
self.client_commit("checkout", message="add propnone")
adm = self._open_adm(path=os.path.abspath("checkout"), write_lock=False)
val = adm.prop_get("svn:nonexistent", os.path.abspath("checkout/propnone"))
self.assertIsNone(val)

def test_text_modified(self):
self.build_tree({"checkout/txtmod": b"content"})
self.client_add("checkout/txtmod")
self.client_commit("checkout", message="add txtmod")
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=False, depth=-1
)
self.assertFalse(adm.text_modified(os.path.abspath("checkout/txtmod"), False))
self.build_tree({"checkout/txtmod": b"changed"})
self.assertTrue(adm.text_modified(os.path.abspath("checkout/txtmod"), False))

def test_props_modified(self):
self.build_tree({"checkout/pmod": b"content"})
self.client_add("checkout/pmod")
self.client_commit("checkout", message="add pmod")
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=False, depth=-1
)
self.assertFalse(adm.props_modified(os.path.abspath("checkout/pmod")))

def test_conflicted(self):
self.build_tree({"checkout/conflfile": b"content"})
self.client_add("checkout/conflfile")
self.client_commit("checkout", message="add conflfile")
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=False, depth=-1
)
result = adm.conflicted(os.path.abspath("checkout/conflfile"))
self.assertIsInstance(result, tuple)
self.assertEqual(3, len(result))
self.assertEqual((False, False, False), result)

def test_has_binary_prop(self):
self.build_tree({"checkout/binfile": b"content"})
self.client_add("checkout/binfile")
self.client_commit("checkout", message="add binfile")
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=False, depth=-1
)
self.assertFalse(adm.has_binary_prop(os.path.abspath("checkout/binfile")))

def test_add(self):
self.build_tree({"checkout/addfile": b"content"})
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=True, depth=-1
)
adm.add(os.path.abspath("checkout/addfile"))

def test_delete(self):
self.build_tree({"checkout/delfile": b"content"})
self.client_add("checkout/delfile")
self.client_commit("checkout", message="add delfile")
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=True, depth=-1
)
adm.delete(os.path.abspath("checkout/delfile"))

def test_delete_keep_local(self):
self.build_tree({"checkout/delkeep": b"content"})
self.client_add("checkout/delkeep")
self.client_commit("checkout", message="add delkeep")
adm = self._open_adm(
path=os.path.abspath("checkout"), write_lock=True, depth=-1
)
adm.delete(os.path.abspath("checkout/delkeep"), keep_local=True)
self.assertTrue(os.path.exists("checkout/delkeep"))


class LockTests(TestCase):
def test_create_lock(self):
lock = wc.Lock()
Expand Down
Loading
Loading