Skip to content

Commit a648d09

Browse files
authored
do not order Remote libraries together with standard libs (#176)
1 parent e7d8b0e commit a648d09

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Ignore paths from .gitignore and ``--exclude`` option, allow to ignore paths through using ``--extend-exclude`` [#110](https://github.com/MarketSquare/robotframework-tidy/issues/110)
77
- Add extra indent for arguments in Suite Setup/Teardown, Test Setup/Teardown in AlignSettingsSection [#155](https://github.com/MarketSquare/robotframework-tidy/issues/155)
88
- OrderSettingsSection will now preserve order of imports. It can be configured to work as before and other settings order can be also preserved [#167](https://github.com/MarketSquare/robotframework-tidy/issues/167)
9+
- When ordering imports with OrderSettingsSection, Remote library will not be grouped with other standard libs [#175](https://github.com/MarketSquare/robotframework-tidy/issues/175)
910
- Allow to disable selected transformers [#170](https://github.com/MarketSquare/robotframework-tidy/issues/170)
1011

1112
### Fixes

robotidy/transformers/OrderSettingsSection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ def fix_eol(node):
232232
def sort_builtin_libs(statements):
233233
before, after = [], []
234234
for comments, statement in statements:
235-
if isinstance(statement, LibraryImport) and statement.name and statement.name in STDLIBS:
235+
if isinstance(statement, LibraryImport) and statement.name and statement.name != 'Remote' \
236+
and statement.name in STDLIBS:
236237
before.append((comments, statement))
237238
else:
238239
after.append((comments, statement))
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*** Settings ***
2+
Library Collections
3+
Library DateTime
4+
Library Dialogs
5+
Library OperatingSystem
6+
Library String
7+
Library XML
8+
Library Browser
9+
Library RequestsLibrary
10+
Library Keywords/MyUtilities.py
11+
Library Remote http://localhost:9050/ WITH NAME JDBCDB2 # DB2
12+
Resource keywords.robot
13+
Resource other_stuff.robot
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*** Settings ***
2+
Library Collections
3+
Library DateTime
4+
Library Dialogs
5+
Library OperatingSystem
6+
Library String
7+
Library XML
8+
Library Browser
9+
Library RequestsLibrary
10+
Library Keywords/MyUtilities.py
11+
Resource keywords.robot
12+
Resource other_stuff.robot
13+
Library Remote http://localhost:9050/ WITH NAME JDBCDB2 # DB2

tests/atest/transformers/OrderSettingsSection/test_transformer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,10 @@ def test_invalid_token_name_in_order(self):
100100
f" Custom order should be provided in comma separated list with valid group names:\n" \
101101
f"['documentation', 'metadata']"
102102
assert expected_output in str(result.exception)
103+
104+
def test_remote_library_as_external(self):
105+
run_tidy_and_compare(
106+
self.TRANSFORMER_NAME,
107+
source='remote_library.robot',
108+
config=':imports_order=library,resource,variables'
109+
)

0 commit comments

Comments
 (0)