MCPcopy Create free account
hub / github.com/gitless-vcs/gitless / TestPerformance

Class TestPerformance

gitless/tests/test_e2e.py:687–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685
686
687class TestPerformance(TestEndToEnd):
688
689 FPS_QTY = 10000
690
691 def setUp(self):
692 super(TestPerformance, self).setUp()
693 for i in range(0, self.FPS_QTY):
694 fp = 'f' + text(i)
695 utils.write_file(fp, fp)
696
697 def test_status_performance(self):
698 def assert_status_performance():
699 # The test fails if `gl status` takes more than 100 times
700 # the time `git status` took.
701 MAX_TOLERANCE = 100
702
703 t = time.time()
704 gl.status()
705 gl_t = time.time() - t
706
707 t = time.time()
708 git.status()
709 git_t = time.time() - t
710
711 self.assertTrue(
712 gl_t < git_t*MAX_TOLERANCE,
713 msg='gl_t {0}, git_t {1}'.format(gl_t, git_t))
714
715 # All files are untracked
716 assert_status_performance()
717 # Track all files, repeat
718 logging.info('Doing a massive git add, this might take a while')
719 git.add('.')
720 logging.info('Done')
721 assert_status_performance()
722
723 def test_branch_switch_performance(self):
724 MAX_TOLERANCE = 100
725
726 gl.commit('f1', m='commit')
727
728 t = time.time()
729 gl.branch(c='develop')
730 gl.switch('develop')
731 gl_t = time.time() - t
732
733 # go back to previous state
734 gl.switch('master')
735
736 # do the same for git
737 t = time.time()
738 git.branch('gitdev')
739 git.stash.save('--all')
740 git.checkout('gitdev')
741 git_t = time.time() - t
742
743 self.assertTrue(
744 gl_t < git_t*MAX_TOLERANCE,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected