You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2002/06/13 04:03:27 UTC

Re: svn commit: rev 2181 - trunk/subversion/tests/clients/cmdline trunk/subversion/tests/clients/cmdline/svntest

[ I got a bit tired of complaints, concerned about people's productivity,
  and simply felt like jammin' out some Python code... :-) ]

On Wed, Jun 12, 2002 at 10:42:46PM -0500, gstein@tigris.org wrote:
>...
> Log:
> Begin the revamp of the Python test system.
> 
> This commit creates a two new classes for representing the state or
> operational information related to a working copy. As an example of
> their use, basic_tests.py was converted.

I'm hoping that this will turn out to be more approachable. It looks like it
to me, but Philip has been the big whiner ;-). Whatcha think, Philip?

The places in basic_tests.py where the "disk trees" are set up still needs
some conversion, but that should be pretty straight-forwards. And, of
course, all of the other test scripts need to be updated... (yowch!)

Oh yah, and code to compare two state objects.

But it is a start...  comments?

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 2181 - trunk/subversion/tests/clients/cmdline trunk/subversion/tests/clients/cmdline/svntest

Posted by Philip Martin <ph...@codematters.co.uk>.
Greg Stein <gs...@lyra.org> writes:

> Summary for comments:
> 
> * forward-slash seems to work fine on Windows

I believe so.  Years ago I used VAX VMS which used '.' for '/' and
surrounded the directory with brackets, the details are vague and I
no longer care ;-)

> * does the .os_path() seem to make sense?

Yup.

> * should .os_path go on the Sandbox? Or on a State? Both? Maybe just a

Sandbox would good except that some of the tests duplicate the working
copy.  The Sandbox is anchored in the original working copy so it
won't be able to provide paths into the duplicate.  So we need State
as well as, or instead of, Sandbox.

>   function in svntest.main?

'sbox.os_path' is shorter than 'svntest.main.os_path' :-)

-- 
Philip

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 2181 - trunk/subversion/tests/clients/cmdline trunk/subversion/tests/clients/cmdline/svntest

Posted by Branko Čibej <br...@xbc.nu>.
Greg Stein wrote:

>On Thu, Jun 13, 2002 at 01:11:31PM +0100, Philip Martin wrote:
>  
>
>>Greg Stein <gs...@lyra.org> writes:
>>...
>>    
>>
>>>But it is a start...  comments?
>>>      
>>>
>>One jumps out.
>>
>>The state objects operate with "Subversion paths" like 'A/D/G/rho' but
>>"OS paths" like os.path_join(wc_dir, 'A', 'D', 'G', 'rho') are
>>required for svntest.actions and for working copy manipulations.  Your
>>    
>>
>
>Well... "required" isn't strictly true :-)
>
>When I was converting the code, I noticed the mixing of path styles. In
>particular, look at line 79 of actions.py (thanks also to Ben for pointing
>out the specific case). We took the '/'-separated paths of main.greek_tree
>and combined them with directories.
>
>And it all seems to work...  My assumption is that Windows is allowing
>forward-slashes (which I believe that I've heard people mention is okay).
>
Actually, svn on Windows _requires_ the forward slashes, and Python 
_allows_ them. And I made sure the os.path thingies return /-separated 
paths by threatening them with Python hacks in main.py.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 2181 - trunk/subversion/tests/clients/cmdline trunk/subversion/tests/clients/cmdline/svntest

Posted by Greg Stein <gs...@lyra.org>.
On Thu, Jun 13, 2002 at 01:11:31PM +0100, Philip Martin wrote:
> Greg Stein <gs...@lyra.org> writes:
>...
> > But it is a start...  comments?
> 
> One jumps out.
> 
> The state objects operate with "Subversion paths" like 'A/D/G/rho' but
> "OS paths" like os.path_join(wc_dir, 'A', 'D', 'G', 'rho') are
> required for svntest.actions and for working copy manipulations.  Your

Well... "required" isn't strictly true :-)

When I was converting the code, I noticed the mixing of path styles. In
particular, look at line 79 of actions.py (thanks also to Ben for pointing
out the specific case). We took the '/'-separated paths of main.greek_tree
and combined them with directories.

And it all seems to work...  My assumption is that Windows is allowing
forward-slashes (which I believe that I've heard people mention is okay).

Now... *should* it ever pose a problem, then we can easily have a State
object return a proper path for us. It could take its .wc_dir attribute and
join that with a path. For example:

  def os_path(self, *parts):
    args = [ self.wc_dir ]
    for part in parts:
      args.extend(string.split(part, '/'))
    return apply(os.path.join, args)

This allows constructs like:

  state.os_path('A')
  state.os_path('A/D')
  state.os_path('A', 'D')
  state.os_path('A/D', 'G/rho')

>...
> I would like to be able to construct OS paths from Subversion
> paths. Then I could write things like
> 
>     G_path = 'A/D/G'
>     rho_path = G_path + '/rho'
>     svntest.main.file_append(xxxx(wc_dir, rho_path), 'some text')
>     svntest.main.run_svn(None, 'rm', xxxx(wc_dir, G_path))
>     svntest.main.run_svn(None, 'rm', '--force', xxxx(wc_dir, G_path))
>     expected_status.tweak_one(G_path, status='D ')
>     expected_status.tweak_one(rho_path, status='D ')
>     shutil.rmtree(xxxx(wc_dir, G_path))

The above would have lines like:

  svntest.main.file_append(expected_status.os_path(rho_path), 'some text')


Hmm. Just thought of something. If wc.State() represents a working copy,
then we could do things like:

  state.run_svn(...)

To have operations performed on items in the working copy referenced by the
State. Of course, we just paths arbitrary paths to 'svn', and it operates on
the appropriate WC, so maybe this is no big deal...

> xxxx is some function (or method, or operator, or whatever) that
> converts
> 
>     (wc_dir, G_path, '/rho')
> 
> into
> 
>     (os.path.join(wc_dir, 'A', 'D', 'G', 'rho'))
> 
> I think I would require the first argument to be an OS path, and all
> subsequent arguments to be Subversion paths.

Well, a State object is already rooted at a wc_dir, so it would be handy for
these types of conversions.

Another alternative is to have the Sandbox object do it. Note that most of
the tests do:

  wc_dir = sbox.wc_dir

It would be quite reasonable to do:

  sbox.os_path('A', 'D')

etc.

I think it really depends on which method the .os_path makes the most sense.
I first started thinking about the State object, but the Sandbox might be
more appropriate.

Summary for comments:

* forward-slash seems to work fine on Windows
* does the .os_path() seem to make sense?
* should .os_path go on the Sandbox? Or on a State? Both? Maybe just a
  function in svntest.main?

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 2181 - trunk/subversion/tests/clients/cmdline trunk/subversion/tests/clients/cmdline/svntest

Posted by Philip Martin <ph...@codematters.co.uk>.
Greg Stein <gs...@lyra.org> writes:

> > This commit creates a two new classes for representing the state or
> > operational information related to a working copy. As an example of
> > their use, basic_tests.py was converted.
> 
> I'm hoping that this will turn out to be more approachable. It looks like it
> to me, but Philip has been the big whiner ;-). Whatcha think, Philip?
> 
> The places in basic_tests.py where the "disk trees" are set up still needs
> some conversion, but that should be pretty straight-forwards. And, of
> course, all of the other test scripts need to be updated... (yowch!)
> 
> Oh yah, and code to compare two state objects.
> 
> But it is a start...  comments?

One jumps out.

The state objects operate with "Subversion paths" like 'A/D/G/rho' but
"OS paths" like os.path_join(wc_dir, 'A', 'D', 'G', 'rho') are
required for svntest.actions and for working copy manipulations.  Your
conversion of basic_tests.py has a lot of literal Subversion paths.

I would like to be able to construct OS paths from Subversion
paths. Then I could write things like

    G_path = 'A/D/G'
    rho_path = G_path + '/rho'
    svntest.main.file_append(xxxx(wc_dir, rho_path), 'some text')
    svntest.main.run_svn(None, 'rm', xxxx(wc_dir, G_path))
    svntest.main.run_svn(None, 'rm', '--force', xxxx(wc_dir, G_path))
    expected_status.tweak_one(G_path, status='D ')
    expected_status.tweak_one(rho_path, status='D ')
    shutil.rmtree(xxxx(wc_dir, G_path))

xxxx is some function (or method, or operator, or whatever) that
converts

    (wc_dir, G_path, '/rho')

into

    (os.path.join(wc_dir, 'A', 'D', 'G', 'rho'))

I think I would require the first argument to be an OS path, and all
subsequent arguments to be Subversion paths.

-- 
Philip

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org