Revision: 3579
Author: janne.t.harkonen
Date: Thu May 27 05:25:35 2010
Log: Removed robotidy as per issue 553
http://code.google.com/p/robotframework/source/detail?r=3579
Deleted:
/trunk/tools/robotidy/doc/robotidy.html
/trunk/tools/robotidy/doc/robotidy.txt
/trunk/tools/robotidy/robotidy.py
/trunk/tools/robotidy/test/data/orig.html
/trunk/tools/robotidy/test/data/variables.py
/trunk/tools/robotidy/test/inplace_and_recursive.tsv
/trunk/tools/robotidy/test/testidy.sh
=======================================
--- /trunk/tools/robotidy/doc/robotidy.html Wed Oct 21 10:35:58 2009
+++ /dev/null
@@ -1,625 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.5:
http://docutils.sourceforge.net/" />
-<title>robotidy.py</title>
-<style type="text/css">
-
-/* Robot Framework User Guide Style Sheet
-
- This stylesheet contains styles from restructuredText's default
- 'html4css1.css' and after that modifications needed for Robot Framework
User
- Guide. These styles are added into the same file against suggestions at
- reST's stylesheet howto mentioned below, because we want to be able to
- embed all styles into the created HTML file. Everything before 'Robot
- Framework User Guide Modifications' text is from 'html4css1.css' without
- any changes so that part can still be changed easily.
-*/
-
-
-/*
-:Author: David Goodger ([email protected])
-:Id: $Id: html4css1.css 5196 2007-06-03 20:25:28Z wiemann $
-:Copyright: This stylesheet has been placed in the public domain.
-
-Default cascading style sheet for the HTML output of Docutils.
-
-See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
-customize this style sheet.
-*/
-
-/* used to remove borders from tables and images */
-.borderless, table.borderless td, table.borderless th {
- border: 0 }
-
-table.borderless td, table.borderless th {
- /* Override padding for "table.docutils td" with "! important".
- The right padding separates the table cells. */
- padding: 0 0.5em 0 0 ! important }
-
-.first {
- /* Override more specific margin styles with "! important". */
- margin-top: 0 ! important }
-
-.last, .with-subtitle {
- margin-bottom: 0 ! important }
-
-.hidden {
- display: none }
-
-a.toc-backref {
- text-decoration: none ;
- color: black }
-
-blockquote.epigraph {
- margin: 2em 5em ; }
-
-dl.docutils dd {
- margin-bottom: 0.5em }
-
-/* Uncomment (and remove this text!) to get bold-faced definition list
terms
-dl.docutils dt {
- font-weight: bold }
-*/
-
-div.abstract {
- margin: 2em 5em }
-
-div.abstract p.topic-title {
- font-weight: bold ;
- text-align: center }
-
-div.admonition, div.attention, div.caution, div.danger, div.error,
-div.hint, div.important, div.note, div.tip, div.warning {
- margin: 2em ;
- border: medium outset ;
- padding: 1em }
-
-div.admonition p.admonition-title, div.hint p.admonition-title,
-div.important p.admonition-title, div.note p.admonition-title,
-div.tip p.admonition-title {
- font-weight: bold ;
- font-family: sans-serif }
-
-div.attention p.admonition-title, div.caution p.admonition-title,
-div.danger p.admonition-title, div.error p.admonition-title,
-div.warning p.admonition-title {
- color: red ;
- font-weight: bold ;
- font-family: sans-serif }
-
-/* Uncomment (and remove this text!) to get reduced vertical space in
- compound paragraphs.
-div.compound .compound-first, div.compound .compound-middle {
- margin-bottom: 0.5em }
-
-div.compound .compound-last, div.compound .compound-middle {
- margin-top: 0.5em }
-*/
-
-div.dedication {
- margin: 2em 5em ;
- text-align: center ;
- font-style: italic }
-
-div.dedication p.topic-title {
- font-weight: bold ;
- font-style: normal }
-
-div.figure {
- margin-left: 2em ;
- margin-right: 2em }
-
-div.footer, div.header {
- clear: both;
- font-size: smaller }
-
-div.line-block {
- display: block ;
- margin-top: 1em ;
- margin-bottom: 1em }
-
-div.line-block div.line-block {
- margin-top: 0 ;
- margin-bottom: 0 ;
- margin-left: 1.5em }
-
-div.sidebar {
- margin: 0 0 0.5em 1em ;
- border: medium outset ;
- padding: 1em ;
- background-color: #ffffee ;
- width: 40% ;
- float: right ;
- clear: right }
-
-div.sidebar p.rubric {
- font-family: sans-serif ;
- font-size: medium }
-
-div.system-messages {
- margin: 5em }
-
-div.system-messages h1 {
- color: red }
-
-div.system-message {
- border: medium outset ;
- padding: 1em }
-
-div.system-message p.system-message-title {
- color: red ;
- font-weight: bold }
-
-div.topic {
- margin: 2em }
-
-h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
-h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
- margin-top: 0.4em }
-
-h1.title {
- text-align: center }
-
-h2.subtitle {
- text-align: center }
-
-hr.docutils {
- width: 75% }
-
-img.align-left {
- clear: left }
-
-img.align-right {
- clear: right }
-
-ol.simple, ul.simple {
- margin-bottom: 1em }
-
-ol.arabic {
- list-style: decimal }
-
-ol.loweralpha {
- list-style: lower-alpha }
-
-ol.upperalpha {
- list-style: upper-alpha }
-
-ol.lowerroman {
- list-style: lower-roman }
-
-ol.upperroman {
- list-style: upper-roman }
-
-p.attribution {
- text-align: right ;
- margin-left: 50% }
-
-p.caption {
- font-style: italic }
-
-p.credits {
- font-style: italic ;
- font-size: smaller }
-
-p.label {
- white-space: nowrap }
-
-p.rubric {
- font-weight: bold ;
- font-size: larger ;
- color: maroon ;
- text-align: center }
-
-p.sidebar-title {
- font-family: sans-serif ;
- font-weight: bold ;
- font-size: larger }
-
-p.sidebar-subtitle {
- font-family: sans-serif ;
- font-weight: bold }
-
-p.topic-title {
- font-weight: bold }
-
-pre.address {
- margin-bottom: 0 ;
- margin-top: 0 ;
- font-family: serif ;
- font-size: 100% }
-
-pre.literal-block, pre.doctest-block {
- margin-left: 2em ;
- margin-right: 2em }
-
-span.classifier {
- font-family: sans-serif ;
- font-style: oblique }
-
-span.classifier-delimiter {
- font-family: sans-serif ;
- font-weight: bold }
-
-span.interpreted {
- font-family: sans-serif }
-
-span.option {
- white-space: nowrap }
-
-span.pre {
- white-space: pre }
-
-span.problematic {
- color: red }
-
-span.section-subtitle {
- /* font-size relative to parent (h1..h6 element) */
- font-size: 80% }
-
-table.citation {
- border-left: solid 1px gray;
- margin-left: 1px }
-
-table.docinfo {
- margin: 2em 4em }
-
-table.docutils {
- margin-top: 0.5em ;
- margin-bottom: 0.5em }
-
-table.footnote {
- border-left: solid 1px black;
- margin-left: 1px }
-
-table.docutils td, table.docutils th,
-table.docinfo td, table.docinfo th {
- padding-left: 0.5em ;
- padding-right: 0.5em ;
- vertical-align: top }
-
-table.docutils th.field-name, table.docinfo th.docinfo-name {
- font-weight: bold ;
- text-align: left ;
- white-space: nowrap ;
- padding-left: 0 }
-
-h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
-h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
- font-size: 100% }
-
-ul.auto-toc {
- list-style-type: none }
-
-
-/* **************************************** *
- * Robot Framework User Guide Modifications *
- * **************************************** */
-
-/* Tables
- - example, tsv-example: test data examples
- - messages: log message examples
- - tabular: normal tabular information
-*/
-table.example, table.tsv-example, table.messages, table.tabular {
- border: 1px solid #808080;
- border-collapse: collapse;
- empty-cell: show;
- margin: 0.5em 2em;
-}
-table.example caption, table.tsv-example caption, table.tabular caption {
- text-align: left;
- padding-bottom: 0.5em;
- font-style: italic;
- font-size: 0.9em;
- width: 100%;
-}
-table.example th, table.example td, table.tsv-example td {
- border: 1px solid #808080;
- font-family: arial,helvetica,sans-serif;
- height: 1.2em;
- font-size: 0.8em;
-}
-table.example th {
- padding: 0.1em 1em;
- background: #E0E0E0;
-}
-table.example td, table.tsv-example td {
- padding: 0.1em 1em 0.1em 0.3em;
-}
-table.tabular th, table.tabular td {
- border: 1px solid black;
- padding: 0.1em 0.3em;
- height: 1.2em;
- font-size: 0.8em;
-}
-table.messages {
- border: 1px solid gray;
- font-family: monospace;
- margin: 1em 2em;
- width: 60%;
-}
-table.messages td {
- vertical-align: top;
- padding: 0.1em 0.2em;
-}
-table.messages td.time {
- width: 7em;
- letter-spacing: -0.05em;
-}
-table.messages td.level {
- width: 5em;
- text-align: center;
-}
-table.messages td.fail, table.messages td.error {
- color: red;
-}
-table.messages td.pass {
- color: #009900;
-}
-table.messages td.warn {
- color: #FFCC00;
-}
-
-/* Roles -- these are defined in roles.txt file */
-
-.var {
- background: #f4f4f4;
- font-size: 0.9em;
-}
-.opt {
- font-style: italic;
-}
-.prog, .code, .cli {
- background: #f4f4f4;
- font-family: monospace;
-}
-.msg {
- font-family: monospace;
-}
-.name {
- font-style: italic;
-}
-.path {
- font-style: italic;
-}
-.misc, .literal {
- background: #f4f4f4;
-}
-
-
-/* Overridden and modified styles */
-
-cite {
- font-size: 0.95em;
-}
-div.admonition, div.attention, div.caution, div.danger, div.error,
-div.hint, div.important, div.note, div.tip, div.warning {
- border: 0.1em solid gray;
- margin: 1em 2em;
- padding: 0.7em 1em;
- font-size: 0.9em;
-}
-pre.literal-block, pre.doctest-block {
- background: #f4f4f4;
-}
-li, li p.first {
- margin-top: 0.3em;
- margin-bottom: 0.3em;
-}
-div.contents li {
- margin-top: 0em;
- margin-bottom: 0em;
-}
-
-
-/* Pygments
-
-- Styles generated using "HtmlFormatter().get_style_defs('.highlight')"
-- Changed only background (f8f8f8 -> f4f4f4) and added margin
-- For more details see e.g. http://pygments.org/docs/quickstart/
-*/
-
-.highlight { background: #f4f4f4; margin: 1em 2em; }
-.highlight .c { color: #408080; font-style: italic } /* Comment */
-.highlight .err { border: 1px solid #FF0000 } /* Error */
-.highlight .k { color: #008000; font-weight: bold } /* Keyword */
-.highlight .o { color: #666666 } /* Operator */
-.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline
*/
-.highlight .cp { color: #BC7A00 } /* Comment.Preproc */
-.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
-.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
-.highlight .gd { color: #A00000 } /* Generic.Deleted */
-.highlight .ge { font-style: italic } /* Generic.Emph */
-.highlight .gr { color: #FF0000 } /* Generic.Error */
-.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-.highlight .gi { color: #00A000 } /* Generic.Inserted */
-.highlight .go { color: #808080 } /* Generic.Output */
-.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
-.highlight .gs { font-weight: bold } /* Generic.Strong */
-.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading
*/
-.highlight .gt { color: #0040D0 } /* Generic.Traceback */
-.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
-.highlight .kd { color: #008000; font-weight: bold } /*
Keyword.Declaration */
-.highlight .kp { color: #008000 } /* Keyword.Pseudo */
-.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
-.highlight .kt { color: #B00040 } /* Keyword.Type */
-.highlight .m { color: #666666 } /* Literal.Number */
-.highlight .s { color: #BA2121 } /* Literal.String */
-.highlight .na { color: #7D9029 } /* Name.Attribute */
-.highlight .nb { color: #008000 } /* Name.Builtin */
-.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
-.highlight .no { color: #880000 } /* Name.Constant */
-.highlight .nd { color: #AA22FF } /* Name.Decorator */
-.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
-.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
-.highlight .nf { color: #0000FF } /* Name.Function */
-.highlight .nl { color: #A0A000 } /* Name.Label */
-.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
-.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
-.highlight .nv { color: #19177C } /* Name.Variable */
-.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
-.highlight .w { color: #bbbbbb } /* Text.Whitespace */
-.highlight .mf { color: #666666 } /* Literal.Number.Float */
-.highlight .mh { color: #666666 } /* Literal.Number.Hex */
-.highlight .mi { color: #666666 } /* Literal.Number.Integer */
-.highlight .mo { color: #666666 } /* Literal.Number.Oct */
-.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
-.highlight .sc { color: #BA2121 } /* Literal.String.Char */
-.highlight .sd { color: #BA2121; font-style: italic } /*
Literal.String.Doc */
-.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
-.highlight .se { color: #BB6622; font-weight: bold } /*
Literal.String.Escape */
-.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
-.highlight .si { color: #BB6688; font-weight: bold } /*
Literal.String.Interpol */
-.highlight .sx { color: #008000 } /* Literal.String.Other */
-.highlight .sr { color: #BB6688 } /* Literal.String.Regex */
-.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
-.highlight .ss { color: #19177C } /* Literal.String.Symbol */
-.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
-.highlight .vc { color: #19177C } /* Name.Variable.Class */
-.highlight .vg { color: #19177C } /* Name.Variable.Global */
-.highlight .vi { color: #19177C } /* Name.Variable.Instance */
-.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
-
-</style>
-</head>
-<body>
-<div class="document" id="robotidy-py">
-<h1 class="title">robotidy.py</h1>
-
-<!-- Roles to use in text like :rolename:`text`. Styled in userguide.css.
-- var variables
-- opt settings in setting table (e.g. Force Tags), tc/kw tables
- (e.g [Documentation]) and command line options (e.g. - -name)
-- prog program names (e.g. rebot, risto.py)
-- code programming code
-- msg test case status and message, as well as log messages and levels
-- name keyword, library, test case, test suite, etc. names
-- cli command line examples (note that options alone use opt)
-- path file names and paths
-- misc everything else (synonym to ``text``) -->
-<p><span class="prog">robotidy.py</span> is a tool for cleaning up Robot
Framework test
-data. It is included in source distributions and can also be
-downloaded from
-<a class="reference external"
href="http://code.google.com/p/robotframework/wiki/TestDataTidyingTool">http://code.google.com/p/robotframework/wiki/TestDataTidyingTool</a>.</p>
-<div class="section" id="synopsis">
-<h1>Synopsis</h1>
-<pre class="literal-block">
-robotidy.py [options] inputfile outputfile
-robotidy.py --inplace [options] inputfile [more input files]
-robotidy.py --recursive [options] directory
-</pre>
-</div>
-<div class="section" id="options">
-<h1>Options</h1>
-<blockquote>
-<table class="docutils option-list" frame="void" rules="none">
-<col class="option" />
-<col class="description" />
-<tbody valign="top">
-<tr><td class="option-group">
-<kbd><span class="option">-I</span>, <span
class="option">--inplace</span></kbd></td>
-<td>Cleans given file(s) so that original file(s) are overwritten.
-When this option is used, it is possible to give multiple
-files at once. Examples: <span class="code">robotidy.py --inplace
tests.html</span>,
-<span class="code">robotidy.py --inplace --fixcomments
*.html</span></td></tr>
-<tr><td class="option-group" colspan="2">
-<kbd><span class="option">-R</span>, <span
class="option">--recursive</span></kbd></td>
-</tr>
-<tr><td> </td><td>Processes the given directory recursively. Files in
the directory
-are processed in place, similarly as when the <span
class="opt">--inplace</span>
-option is used.</td></tr>
-<tr><td class="option-group" colspan="2">
-<kbd><span class="option">-X</span>, <span
class="option">--fixcomments</span></kbd></td>
-</tr>
-<tr><td> </td><td>Fixes comments in the test data.</td></tr>
-<tr><td class="option-group" colspan="2">
-<kbd><span class="option">-F</span>, <span class="option">--format
<var><html|tsv|txt></var></span></kbd></td>
-</tr>
-<tr><td> </td><td>Format to use for output. Possible values are HTML,
-TSV and TXT. If this option is not used, the format is got from
-the extension of the output file.</td></tr>
-<tr><td class="option-group" colspan="2">
-<kbd><span class="option">-T</span>, <span class="option">--title
<var>text</var></span></kbd></td>
-</tr>
-<tr><td> </td><td>The title to use in the test data. By default, the
title is got
-from the name of the output file. If the output file is
-HTML, the title is used with "h1" and "title" tags,
and with
-TSV and TXT it is simply printed before the first table. Possible
-underscores in the given title are converted to spaces.</td></tr>
-<tr><td class="option-group" colspan="2">
-<kbd><span class="option">-S</span>, <span class="option">--style
<var><path></var></span></kbd></td>
-</tr>
-<tr><td> </td><td>Reads styles from an external style sheet file and
replaces
-the default styles with them. If the path has a special value
-NONE, no styles are used. This setting is applicable only
-when the output format is HTML.</td></tr>
-<tr><td class="option-group">
-<kbd><span class="option">-h</span>, <span
class="option">--help</span></kbd></td>
-<td>Prints this help.</td></tr>
-</tbody>
-</table>
-</blockquote>
-</div>
-<div class="section" id="description">
-<h1>Description</h1>
-<p>This multipurpose tool has three usages explained in this section.
-In all cases, the outputs are written in the UTF-8 format.</p>
-<div class="section" id="cleaning-up-the-test-data">
-<h2>Cleaning up the test data</h2>
-<p>The source code created by most HTML editors does not look very good.
With this tool, the
-source can be formatted nicely, and it is even possible to specify a custom
-style sheet. Additionally, test data itself is cleaned up, so that
settings and
-metadata are always in the same, predefined order.</p>
-<p>Examples:</p>
-<pre class="literal-block">
-robotidy.py messed_up_tests.html cleaned_tests.html
-robotidy.py --style new_styles.css my_tests.html my_tests.html
-</pre>
-</div>
-<div class="section" id="changing-format-between-html-tsv-and-txt">
-<h2>Changing format between HTML, TSV and TXT</h2>
-<p>Robot Framework supports test data in HTML, TSV and TXT formats, and
this tool eases
-changing between formats. The input format is always determined from the
-extension of the input file. The output format is also got from the output
file
-extension by default, but it can also be set explicitly with the <span
class="opt">--format</span> option.</p>
-<p>Examples:</p>
-<pre class="literal-block">
-robotidy.py tests_in_html.html tests_in_tsv.tsv
-robotidy.py tests_in_tsv.tsv tests_in_txt.txt
-robotidy.py --format html tests.tsv tests.xxx
-</pre>
-</div>
-<div class="section" id="fixing-comments">
-<h2>Fixing comments</h2>
-<p>RIDE is a great tool for editing the test data, but at least currently,
it
-totally ignores comments. This tool can be used to convert comments, so
that
-they are not lost when the test data is opened in RIDE. Comments in Test
-Case and Keyword tables are changed, so that instead of <span
class="name">#</span>, a built-in
-<span class="name">Comment</span> keyword is used. In Variable tables,
comments are converted to
-<span class="var">@{#}</span> or <span class="var">${#}</span>.
Comments in Setting tables are not fixed.</p>
-<p>Examples:</p>
-<pre class="literal-block">
-robotidy.py --fixcomments orig.html fixed.html
-robotidy.py --fixcomments --inplace *.html
-</pre>
-</div>
-<div class="section" id="fixing-deprecated-syntax-for-repeating-keywords">
-<h2>Fixing deprecated syntax for repeating keywords</h2>
-<p>Robot Framework has an old special syntax for repeating a single
-keyword. This syntax has been deprecated in 2.0.4 version in favor of
-built-in <span class="name">Repeat Keyword</span>, and it will be removed
altogether in
-2.2 version. <span class="prog">robotidy.py</span> automatically replaces
the deprecated
-syntax with <span class="name">Repeat Keyword</span>.</p>
-</div>
-</div>
-</div>
-<div class="footer">
-<hr class="footer" />
-Generated on: 2009-10-21 17:34 UTC.
-
-</div>
-</body>
-</html>
=======================================
--- /trunk/tools/robotidy/doc/robotidy.txt Wed Oct 21 10:35:58 2009
+++ /dev/null
@@ -1,107 +0,0 @@
-.. include:: ../../../doc/userguide/src/roles.txt
-
-===========
-robotidy.py
-===========
-
-:prog:`robotidy.py` is a tool for cleaning up Robot Framework test
-data. It is included in source distributions and can also be
-downloaded from
-http://code.google.com/p/robotframework/wiki/TestDataTidyingTool.
-
-Synopsis
---------
-
-::
-
- robotidy.py [options] inputfile outputfile
- robotidy.py --inplace [options] inputfile [more input files]
- robotidy.py --recursive [options] directory
-
-
-Options
--------
-
- -I, --inplace Cleans given file(s) so that original file(s) are
overwritten.
- When this option is used, it is possible to give
multiple
- files at once. Examples: :code:`robotidy.py --inplace
tests.html`,
- :code:`robotidy.py --inplace --fixcomments \*.html`
- -R, --recursive Processes the given directory recursively. Files in
the directory
- are processed in place, similarly as when
the :opt:`--inplace`
- option is used.
- -X, --fixcomments Fixes comments in the test data.
- -F, --format <html|tsv|txt> Format to use for output. Possible values
are HTML,
- TSV and TXT. If this option is not used, the format is
got from
- the extension of the output file.
- -T, --title text The title to use in the test data. By default, the
title is got
- from the name of the output file. If the output file is
- HTML, the title is used with "h1" and "title" tags,
and with
- TSV and TXT it is simply printed before the first
table. Possible
- underscores in the given title are converted to spaces.
- -S, --style <path> Reads styles from an external style sheet file and
replaces
- the default styles with them. If the path has a
special value
- NONE, no styles are used. This setting is applicable
only
- when the output format is HTML.
- -h, --help Prints this help.
-
-
-Description
------------
-
-This multipurpose tool has three usages explained in this section.
-In all cases, the outputs are written in the UTF-8 format.
-
-
-Cleaning up the test data
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The source code created by most HTML editors does not look very good. With
this tool, the
-source can be formatted nicely, and it is even possible to specify a custom
-style sheet. Additionally, test data itself is cleaned up, so that
settings and
-metadata are always in the same, predefined order.
-
-Examples::
-
- robotidy.py messed_up_tests.html cleaned_tests.html
- robotidy.py --style new_styles.css my_tests.html my_tests.html
-
-
-Changing format between HTML, TSV and TXT
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Robot Framework supports test data in HTML, TSV and TXT formats, and this
tool eases
-changing between formats. The input format is always determined from the
-extension of the input file. The output format is also got from the output
file
-extension by default, but it can also be set explicitly with
the :opt:`--format` option.
-
-Examples::
-
- robotidy.py tests_in_html.html tests_in_tsv.tsv
- robotidy.py tests_in_tsv.tsv tests_in_txt.txt
- robotidy.py --format html tests.tsv tests.xxx
-
-
-Fixing comments
-~~~~~~~~~~~~~~~
-
-RIDE is a great tool for editing the test data, but at least currently, it
-totally ignores comments. This tool can be used to convert comments, so
that
-they are not lost when the test data is opened in RIDE. Comments in Test
-Case and Keyword tables are changed, so that instead of :name:`#`, a
built-in
-:name:`Comment` keyword is used. In Variable tables, comments are
converted to
-:var:`...@{#}` or :var:`${#}`. Comments in Setting tables are not fixed.
-
-Examples::
-
- robotidy.py --fixcomments orig.html fixed.html
- robotidy.py --fixcomments --inplace *.html
-
-
-Fixing deprecated syntax for repeating keywords
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Robot Framework has an old special syntax for repeating a single
-keyword. This syntax has been deprecated in 2.0.4 version in favor of
-built-in :name:`Repeat Keyword`, and it will be removed altogether in
-2.2 version. :prog:`robotidy.py` automatically replaces the deprecated
-syntax with :name:`Repeat Keyword`.
=======================================
--- /trunk/tools/robotidy/robotidy.py Wed Oct 21 10:39:59 2009
+++ /dev/null
@@ -1,762 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2008-2009 Nokia Siemens Networks Oyj
-#
-# 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.
-
-
-"""Tool for cleaning up Robot Framework test data.
-
-Usage: robotidy.py [options] inputfile outputfile
- or: robotidy.py --inplace [options] inputfile [more input files]
- or: robotidy.py --recursive [options] directory
-
-Options:
- -I --inplace Tidy given file(s) so that original file(s) are
overwritten
- When this option is used, it is possible to give
multiple
- files at once. Examples:
- robotidy.py --inplace tests.html
- robotidy.py --inplace --fixcomments *.html
- -R --recursive Process given directory recursively. Files in the
directory
- are processed in place similarly as when '--inplace'
- option is used.
- -X --fixcomments Fix comments in the test data.
- -F --format html|tsv|txt
- Format to use for output. Possible values are HTML, TSV
and
- TXT. If this option is not used, the format is got from
the
- extension of the output file.
- -T --title text Title to use in the test data. By default the title is
got
- from the name of the output file. If the output file is
- HTML the title is used with 'h1' and 'title' tags, and
with
- TSV it is simply printed before the first table.
Possible
- underscores in the given title are converted to spaces.
- -S --style path Read styles from an external style sheet file and
replace
- default styles with them. If the path has a special
value
- 'NONE', no styles are used. This setting is applicable
only
- when the output format is HTML.
- -h --help Print this help.
-
-
-This multipurpose tool has three main usages listed below.
-
-1) Clean up the test data.
-
-Source code created by most HTML editors is quite ugly. With this tool the
-source can be formatted nicely and it is even possible to specify a custom
-style sheet. Additionally test data itself is cleaned up so that settings
and
-metadata is always in same predefined order.
-
-Examples:
- robotidy.py messed_up_tests.html cleaned_tests.html
- robotidy.py --style new_styles.css my_tests.html my_tests.html
-
-2) Change format between HTML, TSV and TXT.
-
-Robot Framework supports test data in HTML, TSV and TXT formats and this
tools
-makes changing between formats trivial. Input format is always determined
from
-the extension of the input file. Output format is also got from the output
file
-extension by default but it can also be set explicitly with '--format'
option.
-
-Examples:
- robotidy.py tests_in_html.html tests_in_tsv.tsv
- robotidy.py --format html tests.tsv tests.xxx
-
-3) Fix comments.
-
-Robot IDE is a great tool for editing the test data but at least currently
it
-totally ignores comments. This tool can be used to convert comments so that
-they are not lost when the test data is opened to the IDE. Comments in test
-case and user keyword tables are changed so that instead of '#' a built-in
-'Comment' keyword is used. In variable tables comments are converted
to '@{#}'
-or '${#}'. Comments in setting tables are not fixed.
-
-Examples:
- robotidy.py --fixcomments orig.html fixed.html
- robotidy.py --fixcomments --inplace *.html
-
-Outputs are always written using UTF-8 encoding.
-"""
-
-
-import sys
-import os
-import glob
-
-from robot.parsing import RawData, rawdatatables, rawdata
-from robot.output import LOGGER
-from robot.errors import DataError, Information
-from robot.variables import is_scalar_var
-from robot import utils
-
-rawdata.PROCESS_CURDIR = False
-
-# Rows having comment in the first cell need to be handled differently
because
-# otherwise they'd start a new tc or uk. Such rows are simply indented one
column
-# right if they are after first real tc/uk has started. If there is a
comment
-# before first element, a new tc/uk is created with name '#' and it's
contents
-# are moved to the firts real tc/uk later if comments are fixed.
-def _monkey_patched_add_row(self, name, data):
- if name.startswith('#'):
- data = [name] + data
- if self._item is not None:
- name = ''
- else:
- name = '#'
- self._orig_add_row(name, data)
-
-rawdatatables.ComplexTable._orig_add_row =
rawdatatables.ComplexTable._add_row
-rawdatatables.ComplexTable._add_row = _monkey_patched_add_row
-
-# Order of names is important because settings/metadata are written in this
-# order (except for 'Teardown' and 'Return')
-_import_names = ['Variables', 'Resource', 'Library']
-_setting_names = ['Documentation', 'Suite Setup', 'Suite Teardown', 'Test
Setup',
- 'Test Teardown', 'Default Tags', 'Force Tags', 'Test
Timeout']
-_test_names = ['Documentation', 'Setup', 'Teardown', 'Tags', 'Timeout']
-_keyword_names = ['Arguments', 'Documentation', 'Return', 'Timeout']
-
-def _create_mapping(names):
- mapping = utils.NormalizedDict()
- for name in names:
- mapping[name] = name
- if 'Documentation' in names:
- mapping['Document'] = 'Documentation'
- return mapping
-
-_import_map = _create_mapping(_import_names)
-_setting_map = _create_mapping(_setting_names)
-_test_map = _create_mapping(_test_names)
-_keyword_map = _create_mapping(_keyword_names)
-_valid_formats = utils.NormalizedDict({'TSV': 'TSV', 'TXT': 'TXT',
- 'HTML': 'HTML', 'HTM': 'HTML',
- 'XHTML': 'HTML'})
-_default_styles = '''
-<style type="text/css">
-html {
- font-family: Arial,Helvetica,sans-serif;
- background-color: white;
- color: black;
-}
-table {
- border-collapse: collapse;
- empty-cells: show;
- margin: 1em 0em;
- border: 0.1em solid black;
-}
-th, td {
- border-style: solid;
- border-width: 0.05em 0.1em;
- border-color: black;
- padding: 0.1em 0.2em;
- height: 1.5em;
-}
-th {
- background-color: rgb(192, 192, 192);
- color: black;
- border-width: 0.1em;
- font-weight: bold;
- text-align: center;
- text-transform: capitalize;
- letter-spacing: 0.1em;
-}
-.col_name, .col_value {
- width: 12em;
-}
-td.col_name {
- background-color: rgb(240, 240, 240);
- text-transform: capitalize;
- letter-spacing: 0.1em;
-}
-</style>
-'''
-
-class Tidy:
-
- def process_file(self, infile, outfile, opts):
- print infile
- try:
- data = TestData(infile, opts['fixcomments'])
- outfile = data.serialize(outfile, opts['format'],
opts['title'],
- opts['style'])
- except:
- LOGGER.error(utils.get_error_message())
- else:
- if infile != outfile:
- print ' `--> %s' % outfile
-
- def process_directory(self, indir, opts):
- for name in os.listdir(indir):
- path = os.path.join(indir, name)
- if os.path.isdir(path):
- self.process_directory(path, opts)
- elif os.path.isfile(path) and self._is_valid_robot_file(name):
- self.process_file(path, None, opts)
-
- def _is_valid_robot_file(self, name):
- base, ext = os.path.splitext(name)
- if not base or (base[0] in ['.', '_'] and
base.lower() != '__init__'):
- return False
- return ext[1:] in _valid_formats
-
-
-class TestData:
-
- def __init__(self, path, fix_comments=False):
- if not os.path.isfile(path):
- raise DataError("'%s' is not a regular file" % path)
- self.path = path
- try:
- self.format = _valid_formats[os.path.splitext(path)[1][1:]]
- except KeyError:
- raise DataError("Valid input formats are HTML, TSV and TXT")
- raw = RawData(path, strip_comments=False)
- if raw.is_empty():
- raise DataError("'%s' contains no test data" % path)
- self.settings = Settings(raw.settings, fix_comments)
- self.variables = Variables(raw.variables, fix_comments)
- self.testcases = TestCases(raw.testcases, fix_comments)
- self.keywords = UserKeywords(raw.keywords, fix_comments)
-
- def serialize(self, outpath, format=None, title=None, style=None):
- format = self._get_format(format, outpath)
- outpath, rm_orig = self._get_outpath_and_remove_orig(outpath,
format)
- serializer = self._get_serializer(outpath, format, title, style)
- self.settings.serialize(serializer)
- self.variables.serialize(serializer)
- self.testcases.serialize(serializer)
- self.keywords.serialize(serializer)
- serializer.close()
- if rm_orig:
- os.remove(self.path)
- return outpath
-
- def _get_format(self, format, outpath):
- if format is None:
- if outpath is None:
- format = self.format
- else:
- format = os.path.splitext(outpath)[1][1:]
- try:
- return _valid_formats[format]
- except KeyError:
- raise DataError("Invalid output format '%s'. Only HTML, TSV
and TXT"
- "are supported." % format)
-
- def _get_outpath_and_remove_orig(self, outpath, format):
- if outpath is not None:
- return outpath, False
- if format == self.format: # inplace, format not changed
- return self.path, False
- return '%s.%s' % (os.path.splitext(self.path)[0], format.lower()),
True
-
- def _get_serializer(self, path, format, title, style):
- title = self._get_title(title, path)
- if format == 'TSV':
- return TsvSerializer(open(path, 'wb'), title)
- if format == 'TXT':
- return TxtSerializer(open(path, 'wb'), title)
- return HtmlSerializer(open(path, 'wb'), title,
self._get_style(style))
-
- def _get_title(self, given_title, path):
- if given_title is not None:
- return utils.printable_name(given_title.replace('_', ' '))
- return utils.printable_name_from_path(path)
-
- def _get_style(self, given_style_path):
- if given_style_path is None:
- return _default_styles
- if given_style_path.upper() == 'NONE':
- return ''
- try:
- return open(given_style_path).read()
- except IOError, err:
- raise DataError("Opening style sheet file '%s' failed: %s"
- % (given_style_path, str(err)))
-
-
-class Settings:
-
- def __init__(self, raw_settings, fix_comments):
- self._imports = dict([ (name, []) for name in _import_names ])
- self._settings = dict([ (name, None) for name in _setting_names ])
- self._metadata = {}
- self._comments = []
- for item in raw_settings:
- if item.name in _import_map:
- self._imports[_import_map[item.name]].append(item.value)
- elif item.name in _setting_map:
- if self._settings[_setting_map[item.name]] is None:
- self._settings[_setting_map[item.name]] = []
- self._settings[_setting_map[item.name]].extend(item.value)
- elif item.name.upper().startswith('META:'):
- self._metadata[item.name[5:].strip()] = item.value
- elif item.name.startswith('#'):
- self._comments.append([item.name] + item.value)
- elif item.name == '':
- self._comments.append(['#'] + item.value)
- else:
- LOGGER.error("Invalid setting '%s'" % item.name)
- if self._comments and fix_comments:
- LOGGER.warn('Comments in setting table are not fixed.')
-
- def serialize(self, serializer):
- serializer.start_settings()
- for name in _import_names:
- for value in self._imports[name]:
- serializer.setting(name, value)
- for name in _setting_names:
- serializer.setting(name, self._settings[name])
- for name, value in sorted(self._metadata.items()):
- serializer.setting('Meta: '+name, value)
- if self._comments:
- serializer.row(['###', 'Comments are not supported in this
table.',
- 'Original comments below.'])
- for comment in self._comments:
- serializer.row(comment)
- serializer.end_settings()
-
-
-def _split_comment(data):
- has_data = False
- for index, item in enumerate(data):
- if item.startswith('#'):
- if has_data:
- return data[:index], data[index:]
- else:
- return None, data
- if item != '':
- has_data = True
- return data, None
-
-
-class Variables:
-
- def __init__(self, raw_vars, fix_comments):
- if not fix_comments:
- self._vars = [ [item.name] + item.value for item in raw_vars ]
- else:
- self._vars = self._fix_comments(raw_vars)
-
- def _fix_comments(self, raw_vars):
- fixed = []
- for item in raw_vars:
- var, comm = _split_comment([item.name]+item.value)
- if var is not None:
- fixed.append(var)
- if comm is not None:
- comm = self._fix_comment(comm)
- if var is not None:
- comm.append('(Comment moved from the end of the
previous variable.)')
- fixed.append(comm)
- return fixed
-
- def _fix_comment(self, data):
- data[0] = data[0][1:].strip()
- if data[0] == '':
- data.pop(0)
- name = len(data) > 1 and '@{#}' or '${#}'
- return [name] + [ utils.escape(item) for item in data ]
-
- def serialize(self, serializer):
- serializer.start_variables()
- for data in self._vars:
- serializer.variable(data[0], data[1:])
- serializer.end_variables()
-
-
-class Keyword:
-
- def __init__(self, data):
- if self._is_repeat_keyword(data[0]):
- data.insert(0, 'Repeat Keyword')
- self._data = data
-
- def _is_repeat_keyword(self, repeat):
- if not repeat.lower().endswith('x'):
- return False
- repeat = repeat[:-1].strip()
- return repeat.isdigit() or is_scalar_var(repeat)
-
- def serialize(self, serializer):
- serializer.keyword(self._data)
-
-
-class FixedKeyword:
-
- def __init__(self, data):
- self._kw_data, self._comm_data = _split_comment(data)
- if self._comm_data is not None:
- self._comm_data = self._fix_comment(self._comm_data)
- if self._kw_data is not None:
- self._comm_data.append('(Comment moved from the end of
the '
- 'previous keyword.)')
-
- def _fix_comment(self, data):
- # Possible one leading empty cell must be preserved because
otherwise
- # comments in blocks (FOR, PARALLEL) would break. Having more than
one
- # leading empty cells is not possible so they are removed.
- # If there are leading empty cells outside blocks executing tests
will
- # fail. Checking are we in a block would be rather big task so
let's
- # just hope this doesn't happen too often...
- leading_empty = 0
- while data[0] == '':
- data.pop(0)
- leading_empty = 1
- data[0] = data[0][1:].strip() # Remove '#'
- if data[0] == '':
- data.pop(0)
- return ['']*leading_empty + ['Comment'] + [ utils.escape(item) for
item in data ]
-
- def serialize(self, serializer):
- if self._kw_data is not None:
- serializer.keyword(self._kw_data)
- if self._comm_data is not None:
- serializer.keyword(self._comm_data)
-
-
-class _TcUkBase:
-
- def __init__(self, raw):
- self.name = raw.name
- self._keywords = [ self._kw_class(kw) for kw in raw.keywords ]
- self._metadata = dict([ (name, None) for name in self._names ])
- for meta in raw.metadata:
- self._add_meta(meta)
-
- def _add_meta(self, raw):
- if raw.name not in self._mapping:
- LOGGER.error("Invalid metadata '%s'" % raw.name)
- return
- if self._metadata[self._mapping[raw.name]] is None:
- self._metadata[self._mapping[raw.name]] = []
- self._metadata[self._mapping[raw.name]].extend(raw.value)
-
- def serialize(self, serializer):
- serializer.start_tc_or_kw(self.name)
- for name in self._names:
- if name != self._post_meta:
- serializer.metadata(name, self._metadata[name])
- for kw in self._keywords:
- kw.serialize(serializer)
- serializer.metadata(self._post_meta,
self._metadata[self._post_meta])
- serializer.end_tc_or_kw()
-
-
-class _TcInfo:
- _names = _test_names
- _mapping = _test_map
- _post_meta = 'Teardown'
-
-class _UkInfo:
- _names = _keyword_names
- _mapping = _keyword_map
- _post_meta = 'Return'
-
-class TestCase(_TcUkBase, _TcInfo):
- _kw_class = Keyword
-
-class FixedTestCase(_TcUkBase, _TcInfo):
- _kw_class = FixedKeyword
-
-class UserKeyword(_TcUkBase, _UkInfo):
- _kw_class = Keyword
-
-class FixedUserKeyword(_TcUkBase, _UkInfo):
- _kw_class = FixedKeyword
-
-
-class _TcsUksBase:
-
- def __init__(self, raw_items, item_class, fix_comments):
- self._items = [ item_class(item) for item in raw_items ]
- if fix_comments and self._items and
self._items[0].name.startswith('#'):
- self._fix_comments_before_first_item()
-
- def _fix_comments_before_first_item(self):
- comment = self._items.pop(0)
- if not self._items:
- LOGGER.warn('Comments in otherwise empty test case or keyword
table are ignored.')
- return
- for item in reversed(comment._keywords):
- item._comm_data.append('(Comment originally before first item
in this table.)')
- self._items[0]._keywords.insert(0, item)
-
-
-class TestCases(_TcsUksBase):
-
- def __init__(self, raw_items, fix_comments):
- tc_class = fix_comments and FixedTestCase or TestCase
- _TcsUksBase.__init__(self, raw_items, tc_class, fix_comments)
-
- def serialize(self, serializer):
- if self._items:
- serializer.start_testcases()
- for tc in self._items:
- tc.serialize(serializer)
- serializer.end_testcases()
-
-
-class UserKeywords(_TcsUksBase):
-
- def __init__(self, raw_items, fix_comments):
- uk_class = fix_comments and FixedUserKeyword or UserKeyword
- _TcsUksBase.__init__(self, raw_items, uk_class, fix_comments)
-
- def serialize(self, serializer):
- serializer.start_keywords()
- for uk in self._items:
- uk.serialize(serializer)
- serializer.end_keywords()
-
-
-class _SerializerBase:
-
- def start_settings(self):
- self._start_table(['Setting', 'Value'], self._setvar_width)
-
- def start_variables(self):
- self._start_table(['Variable', 'Value'], self._setvar_width)
-
- def start_testcases(self):
- self._start_table(['Test Case', 'Action', 'Argument'],
self._tckw_width)
-
- def start_keywords(self):
- self._start_table(['Keyword', 'Action', 'Argument'],
self._tckw_width)
-
- def end_settings(self):
- self._empty_row()
- self._end_table()
-
- end_variables = end_settings
-
- def end_testcases(self):
- if self._table_is_empty:
- self._empty_row()
- self._end_table()
-
- end_keywords = end_testcases
-
- def start_tc_or_kw(self, name):
- self._start_row()
- self._cell(name)
- self._tckw_is_empty = True
-
- def end_tc_or_kw(self):
- if self._tckw_is_empty:
- self._row([], indent=1, started=True)
- self._empty_row()
-
- def metadata(self, name, value):
- if value is not None:
- self._row(['[%s]'%name] + value, 1, self._tckw_is_empty)
-
- def keyword(self, data):
- # Handle indented keywords used with FOR and PARALLEL
- if data[0] == '':
- data = data[1:]
- indent = 2
- else:
- indent = 1
- self._row(data, indent, self._tckw_is_empty)
-
- def setting(self, name, value):
- if value is not None:
- self._row([name] + value)
-
- variable = setting
-
- def row(self, data, indent=0):
- self._row(data, indent)
-
- def _start_table(self, headers, width):
- headers = headers + headers[-1:] * (width-len(headers))
- self._start_row()
- for name in headers:
- self._cell(name, header=True)
- self._end_row()
- self._width = width
- self._table_is_empty = True
-
- def _row(self, data, indent=0, started=False):
- if not started:
- self._start_row()
- self._indent(indent)
- index = indent
- for item in data:
- if index > indent and index % self._width == 0:
- self._end_row()
- self._start_row()
- self._indent(indent)
- self._cell('...')
- index = indent + 1
- self._cell(item)
- index += 1
- while index % self._width != 0:
- self._padding()
- index += 1
- self._end_row()
- self._table_is_empty = self._tckw_is_empty = False
-
- def _cell(self, data, header=False):
- pass
-
- def _empty_row(self):
- self._row([''] * self._width)
-
- def _empty_cell(self, count=1):
- for i in range(count):
- self._cell('')
-
- def _indent(self, count=1):
- self._empty_cell(count)
-
- def _padding(self):
- self._empty_cell()
-
- def _end_table(self):
- pass
-
- def _start_row(self):
- pass
-
- def _end_row(self):
- pass
-
- def close(self):
- pass
-
-
-class HtmlSerializer(_SerializerBase):
-
- _setvar_width = 4
- _tckw_width = 6
-
- def __init__(self, output, title, style):
- output.write('''
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta name="generator" content="robotidy.py" />
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-%(STYLE)s
-<title>%(TITLE)s</title>
-</head>
-<body>
-<h1>%(TITLE)s</h1>
-''' % {'STYLE': style.strip(), 'TITLE': title})
- self._writer = utils.HtmlWriter(output)
-
- def close(self):
- self._writer.end('body')
- self._writer.end('html')
- self._writer.output.close()
-
- def _start_table(self, headers, width):
- self._writer.start('table', {'border':'1'})
- _SerializerBase._start_table(self, headers, width)
-
- def _end_table(self):
- self._writer.end('table')
-
- def _start_row(self):
- self._writer.start('tr')
- self._row_empty = True
-
- def _end_row(self):
- self._writer.end('tr')
-
- def _cell(self, data, header=False):
- elem = header and 'th' or 'td'
- cls = self._row_empty and 'col_name' or 'col_value'
- self._writer.element(elem, data, {'class': cls})
- self._row_empty = False
-
-
-class _PlainTextWriter(_SerializerBase):
- _setvar_width = 8
- _tckw_width = 8
-
- def __init__(self, output, title):
- output.write(' '.join(title.upper()) + '\n\n')
- self._output = output
-
- def close(self):
- self._output.close()
-
- def _end_table(self):
- self._output.write('\n')
-
- def _end_row(self):
- self._output.write('\n')
-
-
-class TsvSerializer(_PlainTextWriter):
-
- def _cell(self, data, header=False):
- if header:
- data = '*%s*' % data
- self._output.write(data.encode('UTF-8') + '\t')
-
-
-class TxtSerializer(_PlainTextWriter):
-
- def _cell(self, data, header=False):
- if header:
- data = '*%s*' % data
- else:
- data = data.strip() or '${EMPTY}'
- self._output.write(data.encode('UTF-8') + ' ')
-
- def _empty_row(self):
- self._output.write('\n')
-
- def _indent(self, count=1):
- for i in range(count):
- if i == 0:
- self._output.write(' ')
- else:
- self._output.write('\\ ')
-
- def _padding(self):
- pass
-
-
-if __name__ == '__main__':
- tidy = Tidy()
- try:
- ap = utils.ArgumentParser(__doc__)
- opts, args = ap.parse_args(sys.argv[1:], help='help')
- if opts['inplace']:
- if len(args) == 0:
- raise DataError('--inplace requires at least one argument')
- for path in args:
- tidy.process_file(path, None, opts)
- elif opts['recursive']:
- if len(args) != 1:
- raise DataError('--recursive requires exactly one
argument')
- if not os.path.isdir(args[0]):
- raise DataError('Parameter to --recursive must be a
directory')
- tidy.process_directory(args[0], opts)
- else:
- if len(args) != 2:
- if len(args) == 1:
- msg = 'Both input and output files must be given'
- else:
- msg = 'Only one input and one output file can be given'
- raise DataError(msg)
- tidy.process_file(args[0], args[1], opts)
- except Information, msg:
- print str(msg)
- except DataError, err:
- LOGGER.error(str(err))
- print '\nUse --help to get usage information.'
=======================================
--- /trunk/tools/robotidy/test/data/orig.html Wed Oct 21 09:08:14 2009
+++ /dev/null
Binary file, no diff available.
=======================================
--- /trunk/tools/robotidy/test/data/variables.py Mon Apr 6 06:28:08 2009
+++ /dev/null
@@ -1,2 +0,0 @@
-sect = u'\xA7'
-good_night = u'Hyv\xE4\xE4 y\xF6t\xE4'
=======================================
--- /trunk/tools/robotidy/test/inplace_and_recursive.tsv Fri Jul 31
06:11:41 2009
+++ /dev/null
@@ -1,61 +0,0 @@
-*Setting* *Value* *Value* *Value* *Value* *Value* *Value* *Value*
-Test Setup Clear Output Directory And Copy Needed Files
-Library OperatingSystem
-
-*Variable* *Value* *Value* *Value* *Value* *Value* *Value* *Value*
-${OUTDIR} ${CURDIR}${/}testoutput
-${HTML} ${OUTDIR}${/}foo.html
-${TSV} ${OUTDIR}${/}foo.tsv
-${HTML2} ${OUTDIR}${/}foo2.html
-${TSV2} ${OUTDIR}${/}foo2.tsv
-${->} \n${space}`-->${space}
-
-*Test Case* *Action* *Argument* *Argument* *Argument* *Argument*
*Argument* *Argument*
-Test Inplace When Format Is Not Changed Run Robotidy --inplace -F TSV
${TSV} 0 ${TSV}
- Files Should Exist In Output Dir ${TSV}
-
-Test Inplace When Format Is Changed From TSV To HTML Run Robotidy
--inplace -F HTML ${TSV} 0 ${TSV}${->}${HTML}
- Files Should Exist In Output Dir ${HTML}
-
-Test Inplace When Format Is Changed From HTML To TSV Run Robotidy --format
HTML ${TSV} ${HTML} 0 ${TSV}${->}${HTML}
- Run Robotidy --inplace -F TSV ${HTML} 0
${HTML}${->}${TSV}
- Files Should Exist In Output Dir ${TSV}
-
-Test Recursive When Format Is Not Changed Run Robotidy --recursive
--format TSV ${OUTDIR} 0 ${TSV}
- Files Should Exist In Output Dir ${TSV}
-
-Test Recursive When Format Is Changed Run Robotidy --recursive --format
HTML ${OUTDIR} 0 ${TSV}${->}${HTML}
- Files Should Exist In Output Dir ${HTML}
-
-Test Recursive When Format Is Changed With Mixed Data Run Robotidy
--format HTML ${TSV} ${HTML 2} 0 ${TSV}${->}${HTML2}
- Run Robotidy --recursive --format TSV ${OUTDIR} 0
${HTML2}${->}${TSV2}\n${TSV}
- Files Should Exist In Output Dir ${TSV} ${TSV2}
-
-Test Changing Format Run Robotidy --format HTML ${TSV} ${HTML} 0
${TSV}${->}${HTML}
- Files Should Exist In Output Dir ${TSV} ${HTML}
-
-Test Using Format When Not Changing It Run Robotidy --format TSV ${TSV}
${TSV} 0 ${TSV}
- Files Should Exist In Output Dir ${TSV}
-
-Using Format And Giving Output File With Wrong ExtensionWhen Not Changing
It Run Robotidy --format HTML ${TSV} ${TSV}.foo 0 ${TSV}${->}${TSV}.foo
- Files Should Exist In Output Dir ${TSV} ${TSV}.foo
-
-
-*Keyword* *Action* *Argument* *Argument* *Argument* *Argument* *Argument*
*Argument*
-Run Robotidy [Arguments] ${options} ${expected rc}=0
${expected output}=
- ${rc} ${output} = Run And Return Rc And Output python
${CURDIR}${/}..${/}robotidy.py ${options}
- Should Be Equal As Integers ${rc} ${expected rc}
- Run Keyword If """""""${expected output}""""""" Should Be Equal ${output}
${expected output}
-
-Clear Output Directory And Copy Needed Files @{files} = List Files In
Directory ${OUTDIR} ${EMPTY} ${EMPTY} True
- Remove Files @{files}
- Create File ${TSV} *** Test Cases ***\nFoo\tBar\n
-
-Files Should Exist In Output Dir [Arguments] @{files}
- :: FOR ${file} IN @{files}
- File Should Exist ${file}
- ${expected number of files} = Get Length ${files}
- ${number of files} = Count Files In Directory ${OUTDIR}
- Should Be Equal As Numbers ${expected number of files}
${number of files}
-
-
=======================================
--- /trunk/tools/robotidy/test/testidy.sh Wed Oct 21 01:50:34 2009
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-
-INDIR=test/data
-OUTDIR=test/testoutput
-
-echo "0) Cleanup"
-rm -rf $OUTDIR
-mkdir $OUTDIR
-cp $INDIR/*.* $OUTDIR
-
-echo "1) Tidying"
-python robotidy.py $OUTDIR/orig.html $OUTDIR/cleaned.html
-python robotidy.py $OUTDIR/orig.html $OUTDIR/cleaned.tsv
-python robotidy.py $OUTDIR/orig.html $OUTDIR/cleaned.txt
-python robotidy.py --fixcomments --title My_Cool_Title \
- $OUTDIR/orig.html $OUTDIR/fixed.html
-python robotidy.py --format tsv -X $OUTDIR/orig.html $OUTDIR/fixed.whatever
-mv $OUTDIR/fixed.whatever $OUTDIR/fixed.tsv
-
-echo
-echo "2) Tidying in place"
-cp $OUTDIR/cleaned.html $OUTDIR/inplace.html
-cp $OUTDIR/cleaned.tsv $OUTDIR/inplace.tsv
-python robotidy.py --fixcomment --inplace --style NONE $OUTDIR/inplace.*
-
-echo
-echo "3) Running tests"
-for data in $OUTDIR/*.*; do
- echo
- echo $data
- pybot --name test --output $data.xml --log none --report none $data \
- 2> /dev/null
-done
-
-echo
-echo "4) Checking statuses"
-for output in $OUTDIR/*.xml; do
- python ../statuschecker/statuschecker.py $output
-done
-
-echo
-echo "5) Diffing results"
-python ../robotdiff/robotdiff.py --report $OUTDIR/tidyresult.html
$OUTDIR/*.xml